Prenylated indole alkaloids such as the calmodulin-inhibitory malbrancheamides and anthelmintic paraherquamides possess great structural diversity and pharmaceutical utility. Here, we report complete elucidation of the malbrancheamide biosynthetic pathway accomplished through complementary approaches. These include a biomimetic total synthesis to access the natural alkaloid and biosynthetic intermediates in racemic form and in vitro enzymatic reconstitution to provide access to the natural antipode (+)-malbrancheamide. Reductive cleavage of an L-Pro-L-Trp dipeptide from the MalG non-ribosomal peptide synthetase (NRPS) followed by reverse prenylation and a cascade of post-NRPS reactions culminates in an intramolecular [4+2] hetero-Diels-Alder (IMDA) cyclization to furnish the bicyclo[2.2.2]diazaoctane scaffold. Enzymatic assembly of optically pure (+)-premalbrancheamide involves an unexpected zwitterionic intermediate where MalC catalyses enantioselective cycloaddition as a bifunctional NADPH-dependent reductase/Diels-Alderase. The crystal structures of substrate and product complexes together with site-directed mutagenesis and molecular dynamics simulations demonstrate how MalC and PhqE (its homologue from the paraherquamide pathway) catalyse diastereo- and enantioselective cyclization in the construction of this important class of secondary metabolites