The modern state of Afghanistan began with the Hotaki and Durrani dynasties in the 18th century. In the late 19th century, Afghanistan became a buffer state in the "Great Game" between British India and the Russian Empire. Following the Third Anglo-Afghan War in 1919, the country became free of foreign dominance, eventually becoming the Kingdom of Afghanistan in June 1926 under King Amanullah. This kingdom lasted almost fifty years, until King Zahir was overthrown and a republic was established in 1973. Its recent history since the late 1970s has been dominated by prolonged warfare, starting with it becoming a socialist state provoking the Soviet–Afghan War and rebel control, territory capture by the Taliban militia and its totalitarian regime, the US invasion and a twenty-year-long war which concluded with the Taliban's summer offensive and the resulting fall of Kabul in August 2021.