Ethanol can be produced with little impact on the environment through the use of polygeneration technology. This paper evaluates the potential of integrating a lignocellulosic ethanol plant into a district heating system by case study; the plant has an ethanol capacity of 95 MW with biogas. electricity and heat as by-products. Stockholms district heating system is used as the case study, but the results may be relevant also for other urban areas. The system has been studied using MODEST - an optimisation model framework. The results show that introducing the plant would lead to a significant reduction in the cost of heat production. The income from the biofuels and electricity produced would be about (sic)76 million and (sic)130 million annually, respectively, which is an increase of 70% compared to the income from the electricity produced in the system today. Assuming that the electricity produced will replace marginal electricity on the European electricity market and that the biofuel produced will replace gasoline in the transport sector, the introduction of the polygeneration plant in the district heating system would lead to a reduction of global CO(2) emissions of about 0.7 million tonnes annually.