Anaerobic digestion of manure and crops provides the possibility of a combined production of renewable energy and organic fertilizer on organic farms and has been suggested as an option to improve sustainability of organic agriculture. In the present study, the consequences of implementation of anaerobic digestion and biogas production were analyzed on a 1000ha model farm with combined dairy and cash crop production, representing organic agriculture in Denmark. The effects on crop rotation, nitrogen flows and losses, yield, energy balance and greenhouse gas (GHG) emissions were evaluated for four scenarios of biogas production on the farm. Animal manure was digested for biogas production in all scenarios and was supplemented with: (1) 100ha grass-clover for biogas, (2) 100ha maize for biogas, (3) 200ha grass-clover for biogas and reduced number of livestock, and (4) 200ha grass-clover for biogas, reduced number of livestock and import of biomass from cuttings made in ungrazed meadows. These four scenarios were compared with the current situation in organic agriculture in Denmark and to a situation where slurry from conventional agriculture is no longer imported. Implementation of anaerobic digestion changed the nitrogen flows on the farm by increasing the slurry nitrogen plant availability and introducing new nitrogen sources from legume-based energy crops or meadows. The amount of nitrogen available for application as fertilizer on the farm increased when grass-clover was used for biogas production, but decreased when maize was used. Since part of the area was used for biogas production, the total output of foodstuffs from the farm was decreased. Effects on GHG emissions and net energy production were assessed by use of the whole-farm model FarmGHG. A positive farm energy balance was obtained for all biogas scenarios, showing that biomass production for biogas on 10% of the farm area results in an energy surplus, provided that the heat from the electricity production is utilized. The energy surplus implies a displacement of fossil fuels and thereby reduced CO2 emission from the farm. Emissions of N2O were not affected substantially by biogas production. Total emissions of methane (CH4) were slightly decreased due to a 17-48% decrease in emissions from the manure store. Net GHG emission was reduced by 35-85% compared with the current situation in organic agriculture. It was concluded that production of biogas on organic farms holds the possibility for the farms to achieve a positive energy balance, provide self-sufficiency with organic fertilizer nitrogen, and reduce GHG emissions.