The Islamic Republic of Afghanistan was a presidential republic in Afghanistan from 2004 to 2021. The state was established to replace the Afghan interim (2001–2002) and transitional (2002–2004) administrations, which were formed after the 2001 United States invasion of Afghanistan that had toppled the partially recognized Taliban-ruled Islamic Emirate of Afghanistan. However, on 15 August 2021, the country was recaptured by the Taliban, which marked the end of the 2001–2021 war, the longest war in US history. This led to the overthrow of the Islamic Republic, led by President Ashraf Ghani, and the reinstatement of the Islamic Emirate under the control of the Taliban, today the ruling government of Afghanistan. While the United Nations still recognizes the Islamic Republic as the legitimate government of Afghanistan, this toppled government controls no portion of the country. The US–Taliban deal, signed on 29 February 2020 in Qatar, was one of the critical events that caused the collapse of the Afghan National Security Forces (ANSF). Following the deal, the US dramatically reduced the number of air attacks and deprived the ANSF of a critical edge in fighting the Taliban insurgency, leading to the Taliban takeover of Kabul.