As part of the heme biosynthetic pathway, catalyzes the sequential polymerization of four molecules of porphobilinogen to form hydroxymethylbilane, also known as preuroporphyrinogen (PubMed:18004775, PubMed:18936296, PubMed:19138865, PubMed:23815679). Catalysis begins with the assembly of the dipyrromethane cofactor by the apoenzyme from two molecules of porphobilinogen or from preuroporphyrinogen. The covalently linked cofactor acts as a primer, around which the tetrapyrrole product is assembled. In the last step of catalysis, the product, preuroporphyrinogen, is released, leaving the cofactor bound to the holodeaminase intact (PubMed:18936296).