Nader Shah was born (as Nadr Qoli) into a humble semi-nomadic family from the Afshar tribe of Khorasan, where he became a local warlord. His path to power began when the Ghilzai Mir Mahmud Hotaki overthrew the weakened and disintegrated Safavid shah Sultan Husayn in 1722. At the same time, Ottoman and Russian forces seized Iranian land. Russia took swaths of Iran's Caucasian territories in the North Caucasus and Transcaucasia, as well as mainland northern Iran, by the Russo-Persian War, while the neighbouring Ottomans invaded from the west. By the 1724 Treaty of Constantinople, they agreed to divide the conquered areas between themselves.
On the other side of the theatre, Nader joined forces with Sultan Husayn's son Tahmasp II and led the resistance against the Ghilzai Afghans, driving their leader Ashraf Khan easily out of the capital in 1729 and establishing Tahmasp on the throne. Nader fought to regain the lands lost to the Ottomans and Russians and to restore Iranian hegemony in Iran. While he was away in the east fighting the Ghilzais, Tahmasp allowed the Ottomans to retake territory in the west. Nader, displeased, had Tahmasp deposed in favour of his baby son Abbas III in 1732. Four years later, after he had recaptured most of the lost Persian lands, Nader felt confident enough to have himself proclaimed shah in his own right at a ceremony on the Moghan Plain.
Nader subsequently made the Russians cede the taken territories taken in 1722–23 through the Treaty of Resht of 1732 and the Treaty of Ganja of 1735. Back in control of the integral northern territories, and with a new Russo-Iranian alliance against the common Ottoman enemy, he continued the Ottoman–Persian War. The Ottoman armies were expelled from western Iran and the rest of the Caucasus, and the resultant 1736 Treaty of Constantinople forced the Ottomans to confirm Iranian suzerainty over the Caucasus and recognised Nader as the new Iranian shah (king).