Nitrogen-containing heterocycles are privileged structures that are ubiquitously found in nature and as active components in various drug candidates. We report an enzymatic cascade for the preparation of N-heterocyclic pyrrolidines and piperidines. Our approach relies on the application of the engineered putrescine oxidase (PuO) from Rhodococcus erythropolis for the oxidation of diamines to the amino aldehyde, which undergoes spontaneous cyclization to the corresponding imine. The engineering of PuO resulted in a triple variant with increased activity towards substituted diamine substrates. Subsequent reduction mediated by the imine reductase (IRED) from Streptosporangium roseum provides access to enantioenriched N-heterocycles. Substituted pyrrolidines and piperidines were obtained with up to 97% product formation in a one-pot reaction directly from the corresponding diamine substrates.