method and apparatus for preparation of fuel from biomass wherein the biomass is subjected to a heat treatment in a temperature range from 150 to 300 c , in a reactor pressurized with steam and air , wherein the pressure at completed treatment is released . the volume increase of steam and other gases from the pressure release is temporarily accumulated in a container of a flexible volume while steam and other gases are subjected to heat exchange in at least one heat exchanger so that condensable gases are condensed and release their heat of condensation in the at least one heat exchanger .