Prebiotically plausible ferrocyanide-ferricyanide photoredox cycling oxidatively converts thiourea to cyanamide, whilst HCN is reductively homologated to intermediates which either react directly with the cyanamide giving 2-aminoazoles, or have the potential to do so upon loss of HCN from the system. Thiourea itself is produced by heating ammonium thiocyanate, a product of the reaction of HCN and hydrogen sulfide under UV irradiation.