A method for producing a medical implant, such as a bone screw, a bone nail, a bone pin, a plate, a suture anchor, etc. for fastening soft parts, such as 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 %, including 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.