A digester is disclosed for controlling the decomposition of organic matter to produce a useful gas and a liquid fertilizer. The digester comprises three slurry chambers connected in tandem by passthrough tubes. A fourth chamber used for gas collection is located above the three slurry chambers. An input line is connected to the bottom of the first chamber and an output line is connected to the bottom of an upright tube provided in the third chamber. A slurry containing raw manure or other organic waste is loaded from a mix tank through the input line to fill the three chambers to a level determined by the top of the upright tube in the third chamber. The process of aerobic digestion and a limited form of anaerobic digestion is carried out in the first chamber and the process of anaerobic digestion which produces the methane gas is carried out in the second chamber which is heated. As an input load of slurry is fed daily from the mix tank into the first chamber, the digested slurry in the third chamber in addition to being fed out through the upright tube as a liquid fertilizer has a small portion thereof recycled back into the mix tank to condition the input load. The gas collected in the fourth chamber is compressed and stored. Such gas in addition to being available for general usage provides for heating the water used to heat the second chamber and for agitating the slurry in the three slurry chambers.