National institutions and policies could provide powerful levers to steer the global food system towards higher agricultural production and lower environmental impact. However, causal evidence of countries' influence is scarce. Using global geospatial datasets and a regression discontinuity design, we provide causal quantifications of the way crop yield gaps, nitrogen pollution and nitrogen pollution per crop yield are influenced by country-level factors, such as institutions and policies. We find that countries influence nitrogen pollution much more than crop yields and there is only a small trade-off between reducing nitrogen pollution and increasing yields. Overall, countries that cause 35% less nitrogen pollution than their neighbours only show a 1% larger yield gap (the difference between attainable and attained yields). Explanations of which countries cause the most pollution relative to their crop yields include economic development, population size, institutional quality and foreign financial flows to land resources, as well as countries' overall agricultural intensity and share in the economy. Our findings suggest that many national governments have an impressive capacity to reduce global nitrogen pollution without having to sacrifice much agricultural production.