Operating capacity of district heat production depends on heat load demand which varies throughout the year. Large capital-extensive production capacity is used briefly for peak-load production while for off-peak periods only capital-intensive base-load is still used. For base-load production, cogeneration of district heat and electricity is often a primary-energy and cost efficient system. In this paper we analyse polygeneration of district heat, electricity and biomotor fuels. We show how different environmental taxation scenarios and changes in crude oil price influence the selection of district heat production units. Our analysis is based on an annual measured district-heat load. We calculate the production costs of district heat and total primary energy use for different polygeneration concepts. Costs are calculated under three environmental taxation scenarios and three crude oil price cases. First, we optimise the cost of a district heat production system based on cogeneration of electricity and heat. We consider cogenerated electricity as a byproduct with value as produced in a reference condensing power plant based on least cost options among different condensing power technologies. Next, we optimize and integrate different biomotor fuel production units into the district heating system considering biomotor fuels as byproducts which are fossil-motor fuel substitutes. We then relate the production cost of district heat and biomotor fuels to evaluate the elasticity between them. We show that the polygeneration improves the primary energy efficiency and reduce the production costs of the generated products. Also, environmental taxation and crude oil price have marginal influences to the produced district heat.