After Napoleon invaded Egypt in 1798 there was a reform movement in Sultan Selim III's regime, to reduce the numbers of the askeri class, who were the first class citizens or military class (also called "janissaries"). Selim was taken prisoner and murdered by the Janissaries. The successor to the sultan, Mahmud II was patient but remembered the results of the uprising in 1807. In 1826 he created the basis of a new, modern army, the Asakir-i Mansure-i Muhammediye, which caused a revolt among the Janissaries. The authorities kept the Janissaries in their barracks and slaughtered thousands of them. This development entered the Ottoman history annals as the Auspicious Incident.