A bioerodible endoprosthesis comprising: a bioerodible magnesium alloy consisting of: between 50 weight percent and 92 weight percent magnesium; Y: 0-10.0 weight percent; Nd: 0-4.5 weight percent; Gd: 0-9.0 weight percent; Dy: 0-8.0 weight percent; Ho: 0-19.0 weight percent; Er: 0-23.0 weight percent; Lu: 0-25.0 weight percent; Tm: 0-21.0 weight percent; Tb: 0-21.0 weight percent; Zr: 0.1-1.5 weight percent; Ca: 0-2.0 weight percent; Zn: 0-1.5 weight percent; In: 0-12.0 weight percent; Sc: 0-15.0 weight percent; incidental impurities up to a total of 0.3 weight percent; and the balance being magnesium and under the condition that a total content of Ho, Er, Lu, Tb and Tm is more than 5.5 weight percent; a total content of Y, Nd and Gd is more than 2.0 weight percent; and a total content of all alloy compounds in the magnesium alloy except magnesium is more than 8.5 weight percent; the bioerodible magnesium alloy having a microstructure comprising equiaxed Mg-rich solid solution phase grains having an average grain diameter of less than or equal to 15 microns; and continuous or discontinuous second-phase precipitates or ceramic nanoparticles in grain boundaries between the Mg-rich solid solution-phase grains, the second-phase precipitates or ceramic nanoparticles having an average longest dimension of 2.0 micron or less. a bioerodible magnesium alloy consisting of: between 50 weight percent and 92 weight percent magnesium; Y: 0-10.0 weight percent; Nd: 0-4.5 weight percent; Gd: 0-9.0 weight percent; Dy: 0-8.0 weight percent; Ho: 0-19.0 weight percent; Er: 0-23.0 weight percent; Lu: 0-25.0 weight percent; Tm: 0-21.0 weight percent; Tb: 0-21.0 weight percent; Zr: 0.1-1.5 weight percent; Ca: 0-2.0 weight percent; Zn: 0-1.5 weight percent; In: 0-12.0 weight percent; Sc: 0-15.0 weight percent; incidental impurities up to a total of 0.3 weight percent; and the balance being magnesium and under the condition that a total content of Ho, Er, Lu, Tb and Tm is more than 5.5 weight percent; a total content of Y, Nd and Gd is more than 2.0 weight percent; and a total content of all alloy compounds in the magnesium alloy except magnesium is more than 8.5 weight percent; between 50 weight percent and 92 weight percent magnesium; Y: 0-10.0 weight percent; Nd: 0-4.5 weight percent; Gd: 0-9.0 weight percent; Dy: 0-8.0 weight percent; Ho: 0-19.0 weight percent; Er: 0-23.0 weight percent; Lu: 0-25.0 weight percent; Tm: 0-21.0 weight percent; Tb: 0-21.0 weight percent; Zr: 0.1-1.5 weight percent; Ca: 0-2.0 weight percent; Zn: 0-1.5 weight percent; In: 0-12.0 weight percent; Sc: 0-15.0 weight percent; incidental impurities up to a total of 0.3 weight percent; and the balance being magnesium and under the condition that a total content of Ho, Er, Lu, Tb and Tm is more than 5.5 weight percent; a total content of Y, Nd and Gd is more than 2.0 weight percent; and a total content of all alloy compounds in the magnesium alloy except magnesium is more than 8.5 weight percent; the bioerodible magnesium alloy having a microstructure comprising equiaxed Mg-rich solid solution phase grains having an average grain diameter of less than or equal to 15 microns; and continuous or discontinuous second-phase precipitates or ceramic nanoparticles in grain boundaries between the Mg-rich solid solution-phase grains, the second-phase precipitates or ceramic nanoparticles having an average longest dimension of 2.0 micron or less.