The Ottoman Empire or, as a dynastic institution, the House of Osman was unprecedented and unequaled in the Islamic world for its size and duration. In Europe, only the House of Habsburg had a similarly unbroken line of sovereigns (kings/emperors) from the same family who ruled for so long, and during the same period, between the late 13th and early 20th centuries. The Ottoman dynasty was Turkish in origin. On eleven occasions, the sultan was deposed (replaced by another sultan of the Ottoman dynasty, who were either the former sultan's brother, son or nephew) because he was perceived by his enemies as a threat to the state. There were only two attempts in Ottoman history to unseat the ruling Ottoman dynasty, both failures, which suggests a political system that for an extended period was able to manage its revolutions without unnecessary instability. As such, the last Ottoman sultan Mehmed VI (r. 1918–1922) was a direct patrilineal (male-line) descendant of the first Ottoman sultan Osman I (r. 1299–1326), which was unparallelled in both Europe (e.g. the male line of the House of Habsburg became extinct in 1740) and in the Islamic world. The primary purpose of the Imperial Harem was to ensure the birth of male heirs to the Ottoman throne and secure the continuation of the direct patrilineal (male-line) descendance of the Ottoman sultans.