
The United States and the Taliban have signed a peace agreement aimed at ending the 18-year war in Afghanistan, potentially helping President Donald Trump fulfill a key campaign promise to extract America from its 'endless wars.'

The deal was signed on Saturday in the Qatari capital Doha by U.S. special envoy Zalmay Khalilzad and Taliban political chief Mullah Abdul Ghani Baradar. U.S. Secretary of State Mike Pompeo was on hand to witness the ceremony.

Under the agreement, the U.S. will begin withdrawing thousands of troops in exchange for Taliban commitments to prevent Afghanistan from being a launchpad for terrorist attacks.

If the Taliban meet their commitments, all U.S. troops would leave in 14 months.

The U.S. invaded Afghanistan after the September 11, 2001 attacks to overthrow the Taliban, which had hosted Osama bin Laden and al-Qaida as they planned and celebrated the assault. The Taliban itself, though a violent group inside Afghanistan, isn't believed to have directly engaged in international terrorism against the West.

US Special Representative for Afghanistan Reconciliation Zalmay Khalilzad and Taliban co-founder Mullah Abdul Ghani Baradar sign the US-Taliban peace agreement during a ceremony in the Qatari capital Doha today

US envoy Khalilzad (left) and Taliban co-founder Mullah Abdul Ghani Baradar shake hands after signing the peace agreement

US Secretary of State Mike Pompeo and Mullah Abdul Ghani Baradar, the leader of the Taliban delegation, both gave remarks

Officials mingle after the agreement signing between Taliban and U.S. officials in Doha, Qatar on Saturday

Pompeo says the U.S. is 'realistic' about the peace deal it signed with the Taliban, but is 'seizing the best opportunity for peace in a generation.'

Speaking after the signing ceremony in Qatar, Pompeo said he was still angry about the 9/11 attacks that were planned by al-Qaeda under Taliban protection in Afghanistan.

Pompeo said the U.S. will not 'squander' what its soldiers 'have won through blood, sweat and tears.'

He said the U.S. will do whatever is necessary for its security if the Taliban do not comply with the agreement.

U.S. Defense Secretary Mark Esper meanwhile traveled to Kabul on a visit that officials and experts said was aimed at reassuring the Afghan government about the United States' commitment to the country.

For Trump, the deal represents a chance to make good on his promise to bring U.S. troops home. But security experts have also called it a foreign policy gamble that would give the Taliban international legitimacy.

'Today is a monumental day for Afghanistan,' the U.S. Embassy in Kabul said on Twitter. 'It is about making peace and crafting a common brighter future. We stand with Afghanistan.'

Hours before the deal, the Taliban ordered all its fighters in Afghanistan 'to refrain from any kind of attack ... for the happiness of the nation.'

'The biggest thing is that we hope the U.S. remain committed to their promises during the negotiation and peace deal,' said Zabiullah Mujahid, a spokesman for the hardline Islamist group.

Though the US are planning to withdraw, there are still more than 16,500 soldiers serving under the NATO banner. Germany has the next largest contingent after the US, with 1,300 troops, followed by Britain with 1,100.

Sources told the MailOnline there will be no immediate change to British military presence in the country.

In all, 38 NATO countries are contributing forces to Afghanistan. The alliance officially concluded its combat mission in 2014 and now provides training and support to Afghan forces.

Afghans in Kabul watch a live TV broadcast at a restaurant during the signing ceremony between the U.S. and the Taliban

U.S. Secretary of State Mike Pompeo (second from left), Minister of Foreign Affairs of Qatar Mohammed bin Abdulrahman bin Jassim Al-Thani (center), Turkish Foreign Minister Mevlut Cavusoglu (center right) and Taliban co-founder and deputy chief Mullah Abdul Ghani Baradar (right) are seen during signing ceremony of peace agreement between US and Taliban

US Secretary of State Mike Pompeo and Qatar's Deputy Prime Minister and Minister of Foreign Affairs Sheikh Mohammed bin Abdulrahman al-Thani attend the signing of a US-Taliban agreement in the Qatari capital Doha today

Members of the Taliban delegation gather ahead of an agreement signing between them and U.S. officials in Doha today

Members of the Taliban delegation pray ahead of an agreement signing between them and US officials in Doha today

Taliban leader Mullah Abdul Salam Zaeef, who served as ambassador to Pakistan during the Taliban's rule, speaks to the media in Doha, Qatar today

Mujahid said it was 'irritating and provocative' that foreign military aircraft continued to fly over Taliban territory, but militia fighters were following the order to stand-down.

For millions of Afghans, the deal represents some hope for an end to years of bloodshed.

'Peace is extremely simple and my country deserves it. Today is the day when maybe we will see a positive change,' said Javed Hassan, 38, a school teacher living on the outskirts of Afghan capital, Kabul.

Hassan's children were killed in a bomb blast carried out by the Taliban in 2018. Since then, he has been writing letters to world leaders urging them to end the Afghan war.

President George W. Bush ordered the U.S.-led invasion of Afghanistan in response to the September 11, 2001 attacks. Some U.S. troops currently serving there had not yet been born when the World Trade Center collapsed on that crisp, sunny morning that changed how Americans see the world.

It only took a few months to topple the Taliban and send Osama bin Laden and top al-Qaida militants scrambling across the border into Pakistan, but the war dragged on for years as the United States tried establish a stable, functioning state in one of the least developed countries in the world.

The Taliban regrouped, and currently hold sway over half the country.

The U.S. spent more than $750 billion, and on all sides the war cost tens of thousands of lives lost, permanently scarred and indelibly interrupted. But the conflict was also frequently ignored by U.S. politicians and the American public.

Ahead of the peace deal this week, Pompeo privately told a conference of U.S. ambassadors at the State Department that he was going only because Trump had insisted on his participation, according to two people present.

US Secretary of State Mike Pompeo arrives to the signing of a US-Taliban agreement in the Qatari capital Doha today. Washington and the Taliban are set to sign a landmark deal in Doha that would see them agree to the withdrawal of thousands of US troops from Afghanistan in return for insurgent guarantees

Trump has repeatedly promised to get the U.S. out of its 'endless wars' in the Middle East, and the withdrawal of troops could provide a boost as he seeks re-election in a nation weary of involvement in distant conflicts

Fighting group: This was the Taliban shortly before the 9/11 attacks. The group seized power and became the Afghan government by 1996, before the US led invasion which toppled them in the wake of the atrocities which hit the World Trade Center, the Pentagon and United Flight 93

Is this the future? General Austin Miller, the most senior US and NATO commander in Afghanistan, walked the streets of Kabul without body armor this week and posed for selfies as the 'reduction in violence' took hold

Dozens of Taliban members meanwhile held a small victory march in Qatar in which they waved the militant group's white flags, according to a video shared on Taliban websites. 'Today is the day of victory, which has come with the help of Allah,' said Abbas Stanikzai, one of the Taliban's lead negotiators, who joined the march.

Trump has repeatedly promised to get the U.S. out of its 'endless wars' in the Middle East, and the withdrawal of troops could provide a boost as he seeks re-election in a nation weary of involvement in distant conflicts.

U.S. troops are to be withdrawn to 8,600 from about 13,000 in the weeks following Saturday's signing. Further drawdowns are to depend on the Taliban meeting certain counter-terrorism conditions, compliance that will be assessed by the United States.

Trump has approached the Taliban agreement cautiously, steering clear of the crowing surrounding other major foreign policy actions, such as his talks with North Korea.

Last September, on short notice, he called off what was to be a signing ceremony with the Taliban at Camp David after a series of new Taliban attacks. But he has since been supportive of the talks led by his special envoy, Zalmay Khalilzad.

Under the agreement, the Taliban promise not to let extremists use the country as a staging ground for attacking the U.S. or its allies. But U.S. officials are loath to trust the Taliban to fulfill their obligations.

The prospects for Afghanistan's future are uncertain. The agreement sets the stage for peace talks involving Afghan factions, which are likely to be complicated. Under the agreement, 5,000 Taliban are to be released from Afghan-run jails, but it's not known if the Afghan government will do that. There are also questions about whether Taliban fighters loyal to various warlords will be willing to disarm.

It's not clear what will become of gains made in women's rights since the toppling of the Taliban, which had repressed women and girls under a strict brand of Sharia law. Women's rights in Afghanistan had been a top concern of both the Bush and Obama administration, but it remains a deeply conservative country, with women still struggling for basic rights.

Fighters with Afghanistan's Taliban militia stand with their weapons in Ahmad Aba district on the outskirts of Gardez, the capital of Paktia province, on July 18, 2017

In this file photo taken on September 12, 2006 US soldiers salute during a ceremony at Bagram air base north of Kabul

In this file photo, an Army carry team moves a transfer case containing the remains of U.S. Army Sgt. 1st Class Michael Goble, a U.S. Special Forces soldier who died in Afghanistan in December 2019

The U.S. has a separate contingent of 5,000 troops deployed to carry out counter-terrorism missions and provide air and ground support to Afghan forces when requested.

Since the start of negotiations with the Taliban, the U.S. has stepped up its air assaults on the Taliban as well as a local Islamic State affiliate. Last year the U.S. air force dropped more bombs on Afghanistan than in any year since 2013.

Seven days ago, the Taliban began a seven-day 'reduction of violence' period, a prerequisite to the peace deal signing.

'We have seen a significant reduction in violence in Afghanistan over the last days, and therefore we are also very close to the signing of an agreement between the United States and the Taliban,' NATO Secretary General Jens Stoltenberg said Friday in Brussels.

He will be in Kabul later Saturday for a separate signing ceremony with Afghan President Ashraf Ghani and U.S. Defence Secretary Mark Esper. That signing is intended to show continuing NATO and U.S. support for Afghanistan.

'The road to peace will be long and hard and there will be setbacks, and there is a risk always for spoilers,' Stoltenberg said. 'But the thing is, we are committed, the Afghan people are committed to peace, and we will continue to provide support.'