The invention relates to a method for producing a medical implant in particular in the form of a bone screw a bone nail a bone pin a plate a suture anchor or the like for fastening soft parts in particular tendons muscles and ligaments to a bone or in the form of an endoprosthesis or at least a part thereof from a magnesium alloy having a magnesium fraction of at least 80 wt% in particular of at least 90 wt% comprising the following steps: a) melting the magnesium alloy to obtain an alloy melt b) atomizing the alloy melt under a protective gas atmosphere and cooling the atomized alloy melt to below the solidification point thereof in order to obtain an alloy powder c) shaping the alloy powder by pressing to obtain an alloy green body d) extruding the alloy green body to obtain a magnesium alloy molded part and e) producing the medical implant from the magnesium alloy molded part. The invention further relates to a medical implant that can be obtained according to the aforementioned method.