In the early 16th century, the Shi'ite Safavid dynasty assumed control in Persia under the leadership of Shah Ismail I, defeating the ruling Turcoman federation Aq Qoyunlu (also called the "White Sheep Turkomans") in 1501. The Ottoman sultan Selim I sought to repel Safavid expansion, challenging and defeating them at the Battle of Chaldiran in 1514. Selim I also deposed the ruling Mamluks in Egypt, absorbing their territories in 1517. Suleiman I (also known as "Suleiman the Magnificent"), Selim I's successor, took advantage of the diversion of Safavid focus to the Uzbeks on the eastern frontier and recaptured Baghdad, which had fallen under Safavid control. Despite this, Safavid power remained substantial, rivalling the Ottomans. Suleiman I advanced deep into Hungary following the Battle of Mohács in 1526 — reaching as far as the gates of Vienna thereafter, and signed a Franco-Ottoman alliance with Francis I of France against Charles V of the Holy Roman Empire 10 years later. While Suleiman I's rule (1520–1566) is often identified as the apex of Ottoman power, the empire continued to remain powerful and influential until a relative fall in its military strength in the second half of the eighteenth century.