The gene encoding N-methylputrescine oxidase (MPO) and constructs comprising such DNA are provided, including methods of regulating MPO expression independently or with other alkaloid biosynthesis genes to modulate alkaloid production in plants and host cells. MPO genes or fragments thereof are useful for reducing pyrrolidine or tropane alkaloid production in plants, for increasing pyrrolidine or tropane alkaloid production in plants, and for producing an MPO enzyme in host cells.