Over 18 years after the war began, the accord sets the stage for US troop pullout from Afghanistan. If the deal is successful, the "graveyard of empires" will have once again successfully turned away another world power from its landlocked borders.
The Afghan Taliban and the US on Saturday signed a landmark peace deal in Doha that would see them agree to the withdrawal of thousands of US troops from Afghanistan in return for insurgent guarantees.
Taliban fighter-turned-dealmaker Mullah Baradar signed the accord alongside Washington's chief negotiator Zalmay Khalilzad, at a gilded desk in a conference room in a luxury Doha hotel.
The pair then shook hands, as people in the room shouted: "Allahu Akbar" (God is greatest).
US Secretary of State Mike Pompeo looked on as the two inked the deal, after urging the insurgents to "keep your promises to cut ties with Al Qaeda."
Pompeo called on the Taliban to honour its commitments to sever ties with militant groups.
"I know there will be a temptation to declare victory, but a victory for Afghans will only be achieved when they can live in peace and prosper," he said at the ceremony in Doha.
Trump hails deal
US President Donald Trump hailed a deal and said he would be "personally" meeting leaders of the group in the near future.
At a press conference at the White House, Trump said Afghanistan's neighbours should help maintain stability following the agreement.
Many expect the forthcoming talks between the Afghan sides to be more complicated than the initial deal.
But Trump said he thought the negotiations would be successful because "everyone is tired of war."
The US leader said he believed the Taliban were ready for peace but warned that should the deal fail to take hold, "we'll go back."
Earlier in Kabul, US Defense Secretary Mark Esper separately issued a joint declaration with the Kabul government.
In that declaration, Washington and Kabul said the United States and its allies will withdraw all their forces from Afghanistan within 14 months if the Taliban abide by the peace deal.
After an initial reduction of troops to 8,600 within 135 days of Saturday's signing, the US and its partners "will complete the withdrawal of their remaining forces from Afghanistan within 14 months ... and will withdraw all their forces from remaining bases," the declaration stated.
It stated that the US will refrain from the use of force against the territorial integrity of Afghanistan, and will not intervene in domestic affairs.
Kabul government also committed to engage with UNSC to remove Taliban members from sanctions list by May 29.
The US and the Taliban agreed to swap thousands of prisoners in a "confidence-building measure" as part of a landmark deal.
"Up to 5,000 prisoners of the (Taliban) ... and 1,000 prisoners of the other side (Afghan forces) will be released by March 10," the deal said.
Dialogue between the Kabul government and the Taliban is due to begin by that date.
'Graveyard of empires'
More than 18 years since President George W Bush ordered bombing in response to the September 11, 2001, attacks, the agreement will set the stage for the withdrawal of US troops, some of whom were not yet born when the World Trade Center collapsed on that crisp, sunny morning that changed how Americans see the world.
In the Qatari capital of Doha, America's top diplomat stood with leaders of the Taliban, Afghanistan's former rulers who harboured Osama bin Laden and his Al Qaeda.
It was likely an uncomfortable appearance for Pompeo, who privately told a conference of US ambassadors at the State Department this week that he was going only because President Trump had insisted on his participation, according to two people present.
If the agreement is successful, Afghanistan, the "graveyard of empires" which has repeatedly repelled foreign invaders from imperial Britain and Russia to the Soviet Union, will have once again successfully turned away another world power, the US, from its landlocked borders.
The agreement is expected to lead to a dialogue between the Kabul government and the Taliban that, if successful, could ultimately see the Afghan war wind down.
But the position of the Afghan government, which has been excluded from direct US-Taliban talks, remains unclear and the country is gripped by a fresh political crisis amid contested election results.
The deal, drafted over a tempestuous year of dialogue marked by the abrupt cancellation of the effort by Trump in September, is expected to lay out a timetable for withdrawal of US forces.
While Kabul was not represented at the Doha signing, at 1245 GMT, it will send a six-person task force to the Qatari capital to make initial contact with the Taliban political office, established in 2013.
The Taliban's spokesman in Doha, Suhail Shaheen, told a Qatari newspaper that he expected the group's presence in the Gulf state to continue after Saturday's signing to facilitate engagement with the Kabul government.
The insurgents said they had halted all hostilities on Saturday in honour of the agreement.
"Since the deal is being signed today, and our people are happy and celebrating it, we have halted all our military operations across the country," Taliban spokesman Zabihullah Mujahid told AFP.
Abdul Salam Zaeef, former Taliban ambassador to Pakistan said, "The Taliban are giving insurance to the people of Afghanistan that the next Afghanistan will be stable and Afghanistan will be for all Afghans — including women, men, minorities, majorities, all of them — and we will work together to make Afghanistan a stable Afghanistan, a peaceful Afghanistan, and to make more progress."
Qatar and Pakistan's role
Qatar, a peninsula nation protruding from the Arabian desert into the Gulf and better known for its gas riches and controversial 2022 World Cup bid victory, was a seemingly unlikely choice to host negotiations.
But by providing neutral space for talks on ending the conflict, it has boosted its international profile and helped it defy a painful regional embargo led by Saudi Arabia, which accuses it of being too close to Islamist movements.
Talks have taken place in a plush members' club in Doha, where turbaned Taliban fighters-turned-negotiators and suited American officials have rubbed shoulders with club-goers in Hawaiian shirts and swimwear.
As many as 30 nations including Pakistan were represented at Saturday's signing in the Qatari capital. The US is staging a separate ceremony in Kabul with the Afghan government, an Afghan source told AFP news agency.
Islamabad played a crucial role in advancing mediation efforts between the Taliban and Washington, positioning itself as a powerful bargaining force in the future of Afghanistan.
The inking of the deal has come after a week-long, partial truce that has mostly held across Afghanistan, aimed at building confidence between the warring parties and showing the Taliban can control their forces.
While isolated attacks have continued in rural areas, Pompeo said on Tuesday that the truce period was "working."
"We're on the cusp of an enormous, enormous political opportunity," he said.
President Trump also urged the Afghan people to embrace the chance for a new future, saying the deal held out the possibility of ending the 18-year conflict.
"If the Taliban and the government of Afghanistan live up to these commitments, we will have a powerful path forward to end the war in Afghanistan and bring our troops home," he said on the eve of the event.
Blood and treasure
The US, which currently has between 12,000 and 13,000 troops in Afghanistan, could draw that number down to 8,600 within months of the agreement being signed.
Further reductions would depend on the Taliban's engagement with Ghani's government, which they have until now dismissed as a US puppet.
"This is just a precursor to get that process started, it's not a cause for celebration among the government or its allies," said International Crisis Group analyst Andrew Watkins.
Ghani has been declared the winner of last year's election, but his main rival, Abdullah Abdullah, is refusing to recognise the win and has vowed to set up a rival government.
Any insurgent pledge to guarantee Afghanistan is never again used by militant groups such as Al Qaeda and Daesh to plot attacks abroad will be key to the deal's viability.
The conflict has cost the US taxpayer more than $1 trillion in military and rebuilding costs since the US-led invasion of 2001.
More than 100,000 Afghan civilians have been killed or wounded over the past decade, according to the United Nations.