The Mannich reaction involves the condensation of an enolizable carbonyl compound, an amine or ammonia, and formaldehyde to form an aminomethyl derivative known as a Mannich base. Ketones are most commonly used as the carbonyl compound. The reaction proceeds via the generation of an imine intermediate from the carbonyl compound and amine, which then reacts with formaldehyde to form the Mannich base. Mannich bases have applications in synthesizing natural products like alkaloids and building ring systems.