In a method for separating magnesium ammonium phosphate from sludge of a treatment plant, an anaerobic sludge is subjected to a dewatering (4), a magnesium salt is added to a filtrate obtained in the dewatering (4) and magnesium ammonium phosphate is precipitated, and magnesium ammonium phosphate crystals are separated from the filtrate, a pH value of the anaerobic sludge is adjusted to a basic pH value before the dewatering (4) by aerating the sludge, an aqueous magnesium chloride solution, optionally an aqueous MgCl2-suspension, containing at least 5 wt.% MgCl2, is added to the filtrate produced with the dewatering (4), optionally with simultaneous aeration, and precipitated magnesium ammonium phosphate crystals are transferred into a cleaning stage (10), and impurities of the formed magnesium ammonium phosphate crystals are removed with sludge, optionally by washing with water, and the magnesium ammonium phosphate crystals are delivered.