Nitrate leaching forms an important environmental problem because it causes pollution of groundwater and surface water, and adds to already problematic eutrophication. This study analyses the impact of reductions in nitrate leaching on land cover decisions of dairy farms, of which the activities make an important contribution to nitrate leaching. As the level of nitrate leaching depends on groundwater depth as well as on the supply of nitrogen, spatial variation in groundwater levels will cause a spatial variation in land cover under restrictions on nitrate leaching. A non-linear partial optimisation model for the economic and ecological aspects of the problem were used to show how land cover and dairy farms' financial balances change when nitrate losses are reduced. The model is spatially explicit, and describes nitrate leakage and yields of maize and grass as a function of groundwater depth, including the effects of various grazing systems. The model analyses the decisions of a risk neutral agent who minimises costs under the following constraints: (i) production, feed requirements and mass balances for fodder; (ii) constraints for nitrate leaching. Economic costs are attributed to increased costs of fodder and processing of manure when nitrate restrictions are tightened. An important result of the study is the variation in compliance costs and land cover for maize and grass production brought about by spatial variation in groundwater depth. While the effects are negligible for some shallow groundwater classes, it is extremely difficult in other classes - if not impossible - to obtain the EU standard of maximum admissible losses of 34 kg N ha-1 at low costs. The study shows an important reduction in land cover by maize.