During the Soviet invasion of Afghanistan in the 1980s, the Western-educated Hamid Karzai served the resistance as an advisor and diplomat, winning the loyalty of the Mujahideen, or "holy warriors," who finally expelled the Soviets from Afghanistan. Karzai was deputy foreign minister in the postwar government from 1992 to 1994, but the country was soon rent by civil war as local warlords competed for power. The Taliban movement sought Karzai's support in restoring order, and offered him the post of United Nations ambassador, but he broke with the new regime when it fell under the influence of foreign terrorists.
From a base in Pakistan, Karzai began to organize anti-Taliban opposition. When his father was murdered in Pakistan, presumably by agents of the Taliban, Hamid Karzai, was selected to succeed his father as Khan of the half-million Popalzai. He immediately defied both the Pakistan and Taliban governments by leading a convoy of tribal mourners to carry his father's body home for burial in Kandahar, a stronghold of the Taliban. The Taliban did not dare intervene. This act of defiance made Hamid Karzai the most visible leader of Pashtun resistance to the Taliban.
Four factions representing the major ethnic groups of Afghanistan met in Bonn, Germany to form an interim administration. Setting aside their old and bitter divisions, all factions agreed on the multi-lingual, cosmopolitan Karzai to head an interim administration until the traditional grand council of the Afghan peoples, the Loya Jirga, could be convened to create a provisional government and draft a new constitution.
As Chairman of the interim administration, Hamid Karzai quickly won the support of the world community for his vision of a stable, peaceful Afghanistan. In June of 2002, days after he atended the International Achievement Summit in Dublin, the Loya Jirga elected Hamid Karzai to serve as President of Afghanistan. As President, he survived assassination attempts and the efforts of extremists to disrupt the country's first national election. In September 2004, he was elected to a full five-year term as the first directly elected President in the country's history.
In the first round of voting in September, it appeared that President Karzai had won a decisive victory, claiming over 50 percent of the vote. A commission appointed by the United Nations, investigating charges of fraudulent voting at some locations, determined that Karzai's share of the vote actually fell under the 50 percent threshold, compelling a run-off election between Karzai and the runner-up, former Foreign Minister Abdullah Abdullah. A few days before the scheduled run-off, Abdullah questioned the integrity of the election process and withdrew from the race. Afghanistan's electoral commission declared President Karzai the victor by default. The United States, which had withheld judgment on the initial results, now moved quickly to recognize the electoral commission's judgment as final.
Over the course of his second term Karzai became more bitterly critical of U.S. strategy, particularly the night raids in Afghan villages and their accompanying civilian casualties. His relationship with his former ally deteriorated further when he released a number of prisoners that U.S. forces had turned over to the Afghan authorities. With his second and final term as President set to expire in 2014, Karzai declined to sign a Bilateral Security Agreement (BSA) that would have authorized a continued U.S. presence in Afghanistan. In September 2014 Ashraf Ghani was elected to succedd Karzai in the first peaceful transtion from one elected government to another in Afghanistan's long history.