TECHNOLOGY FOCUS - ORGANIC CHEMISTRY - Preferred Method: The biomass is pretreated in a hydrolysis step at normal pressure before the first fermentation step, at a temperature of 25-60 degrees C and the hydrolysis is carried out at a pH of 5-8. The retention period of the biomass in the hydrolysis step amounts to 3-8 days, where a carbon dioxide containing gas mixture with a high concentration of hydrogen sulfide is produced, which is removed and cleaned. The retention period of the biomass in the hydrolysis step is controlled with the biogas to be withdrawn, which is measured according to the hydrogen sulfide concentration, where a lower limit is set, based on the raw material composition and the hydrolysis conditions, and after reaching a peak and subsequent decline in hydrogen sulfide concentration up to this limit, the hydrolysis is terminated. The biogas obtained from the hydrolysis step is purified, where the methane content in the biogas is increased by 3-5 times. The biogas obtained from the hydrolysis step and the two fermentation steps is purified and subsequently conducted to a gas stream together for further use. At least one portion of the liquid phase of a stripping step, separated from the digestate of the first fermentation step is fed into the liquid phase containing ammonia, and purified, and the purified liquid phase is stored temporarily. The solid phase separated from the digestate of the first fermentation step is mixed with purified liquid phase and conducted for the second fermentation step. The raw product biomass is pretreated in a preparation step under the addition of ammonia reduced fermentation water from the process circuit. The solid phase obtained from the first fermentation step is pretreated in a second preparation step under the addition of ammonia reduced fermentation water from the process circuit. The solid phase separated after the first fermentation step is subjected to a thermal treatment at a temperature of upto 180 degrees C and a pressure of upto 10 bars, under the addition of acidic or alkaline effective additives. The ammonia with upto a concentration of 0.5 mg/l is separated from warmed fermentation water using stripping gas in the stripping step under increased pressure. The polluted stripping gas is treated in a washing step using an acidic wash solution, where the ammonia contained in the gas stream is converted into ammonium- or phosphorus sulfate or other salts and separated. EXAMPLE - cattle manure with a total solid content of 6% (1512 kg), manure with a total solid content of 25% (302 kg), corn with a total solid content of 32% (116 kg) and grass silage with a total solid content of 30% (349 kg) were introduced into a mixing container. Then fermentation was carried out for 1 hour with the continuous supply of water and the fermenting substrate (3.57 m3/hour) in a first fermenter. Then the biogas containing methane (55 vol.%), carbon dioxide (41 vol.%), water (3.5 vol.%), hydrogen sulfide (60 ppm) and ammonia (35 ppm), was obtained in the first fermenter. The obtained biogas was then mixed with the biogas of the second fermenter, and the mixture was then purified and recycled. Then the fermenting substrate was removed from the first fermenter after 20 days, and fed into a separating device for separating into a liquid phase and a solid phase, which were recycled in the first fermenter and the second fermenter, respectively. The biogas containing methane (54 vol.%), carbon dioxide (43 vol.%), water (3 vol.%), hydrogen sulfide (40 ppm) and ammonia (42 ppm), was obtained in the second fermenter. The biogas was produced at the rate of 114 Nm3/hour from both the fermenter with the methane content of 54.8 vol.%.