Faba bean (Vicia faba L.) is a widely adapted and high-yielding legume cultivated for its protein-rich seeds1. However, the seeds accumulate the pyrimidine glucosides vicine and convicine, which can cause haemolytic anaemia (favism) in 400 million genetically predisposed individuals2. Here, we use gene-to-metabolite correlations, gene mapping and genetic complementation to identify VC1 as a key enzyme in vicine and convicine biosynthesis. We demonstrate that VC1 has GTP cyclohydrolase II activity and that the purine GTP is a precursor of both vicine and convicine. Finally, we show that cultivars with low vicine and convicine levels carry an inactivating insertion in the coding sequence of VC1. Our results reveal an unexpected, purine rather than pyrimidine, biosynthetic origin for vicine and convicine and pave the way for the development of faba bean cultivars that are free of these anti-nutrients.