Urban and peri-urban agriculture (UPA) covers about 10% of the global food demand, and substantially contributes to the income of the urban poor. However, surprisingly little quantitative data exist about the sustainability and resource use efficiency of UPA and its contribution to maintaining plant biodiversity. Horizontal and vertical flux measurements of carbon (C), nitrogen (N), phosphorus (P) and potassium (K) as well as biodiversity studies were conducted to analyze UPA systems in selected major cities of sub-Saharan Africa. In Niamey (Niger) annual partial (horizontal) C and N balances amounted to 4,454-28,320 kg C ha-1 and -142-597 kg N ha-1 in low input gardens while in high input gardens annual surpluses of 785-19,588 kg C ha-1 and 890-2,991 kg N ha-1 were recorded. In low input river water gardens mean annual gaseous C emissions reached 20-25 t ha-1 of which 98% occurred as CO2 while NH3-N and N2O-N emissions varied from 20-29 kg ha-1 yr-1. In a high input garden irrigated with wastewater, annual CO2-C emissions amounted to 27 t ha-1 while N2O was the main contributor to measured N losses (68%) which together with NH3 reached 92 kg N ha-1 yr-1. About 28% of total annual gaseous C emissions and 30-40% of N volatilization occurred during the hot dry season from March to May and another 20-25% and 10-20%, respectively, at the onset of the rainy season in June and July. Mean annual N leaching losses ranged from 2.2-7.3 kg ha-1; annual P leaching was with 0.7 kg ha-1 negligible. Animal manure, a major source of N input in UPA systems of West Africa, but not in Khartoum (Sudan) where it is used for brick making, is typically subjected to large C and N emanation losses if stored in the open. Simple plastic sheet roofing can not only lead to substantial reductions of such losses during both the hot dry and the rainy season, particularly if combined with rockphosphate (RP) applied at 333 g kg-1 manure dry matter (DM), but also reduce nutrient losses by leaching and run off. The biodiversity studies in Niamey showed that UPA gardens can maintain a large variety of fruit and vegetable species. Plant species richness increased with garden and household size (p<0.001) and, in contrast to general belief, also with the degree of produce commercialization.