The safety and security of different foodstuffs are considered important and have a high priority in global sustainable development. The contents of Fe, Mn, Cu, Zn, Ni, Pb and Cd were estimated in edible parts of 60 vegetable samples, irrigation water and agricultural soil collected from 5 farms in suburban areas around Riyadh district, Saudi Arabia. Also, soil pollution indices, pollution load index and contamination factor (PLI, CF), bioaccumulation factor (BAF), non-carcinogenic and carcinogenic risk indices (HQ, THQ, and ILCR) were estimated. The content of heavy metals in irrigation water and soil was within the recommended permissible levels, except for Cd in soil, which exceeds permissible levels. The trend of metal concentrations in both agricultural soil and vegetables was found in the order: Fe > Mn > Zn > Cu > Ni > Pb > Cd. Cluster analysis of the metal content in vegetables showed a tendency towards the accumulation of heavy metals in the order of leaves > roots > fruits > flowers > tuber. The BAFs values found were < 1.0, HQs values for Fe, Mn, Cu, Zn and Ni were found to be < 1, while the estimated HQs for Pb and Cd were > 1, posing greater risk to the health of adults and children. THQ values were higher for children compared to adults. ILCR values for Cd showed a serious issue, as it exceeds the threshold risk limit (>10−4) in all parts of the investigated vegetables in all sampling sites. [ABSTRACT FROM AUTHOR]