These efforts, however, were hampered by reactionary movements, partly from the religious leadership, but primarily from the Janissary corps, who had become anarchic and ineffectual. Jealous of their privileges and firmly opposed to change, they created a Janissary revolt. Selim's efforts cost him his throne and his life, but were resolved in spectacular and bloody fashion by his successor, the dynamic Mahmud II, who massacred the Janissary corps in 1826.