Louis the German occupied Moravia and dethroned Rastislav, and the Bavarian prelates imprisoned Methodius in 870. Svatopluk united his realm with Moravia around 871 and expanded the territory under his rule during the next decades. Methodius was set free on Pope John VIII's demand in 873. However, after his death in 885, his disciples were expelled from Moravia. Svatopluk died in 894. His realm disintegrated because internal conflicts emerged after his death. The Magyars who settled in the Carpathian Basin around 895 destroyed Moravia in the first decade of .