U.S. envoy Zalmay Khalilzad and Taliban deputy leader Mullah Abdul Ghani Baradar inked the deal in an opulent hall in a five-star hotel in Dohar, Qatar. Secretary of State Mike Pompeo witnessed the signing.

The agreement lays out a path for a full withdrawal of U.S. troops from Afghanistan beginning with a drawdown to 8,600 troops “within months” upon President Trump’s orders, according to the top U.S. commander in Afghanistan, Gen. Austin “Scott” Miller.

The deal stipulates that the Taliban will pledge to enter into talks with the Afghan government and not to harbor terrorist groups intent on attacking the West.

In Kabul, Defense Secretary Mark T. Esper attended a ceremony with NATO Secretary-General Jens Stoltenberg and Afghan President Ashraf Ghani.

“From the first day that Americans came, neither we wanted them to stay for centuries, nor they wanted that,” acting Afghan defense minister Asadullah Khalid said ahead of the ceremony in Kabul. Speaking to the press in remarks carried by Afghan state television, he said the departure of a “few thousand” U.S. troops would not affect security in Afghanistan.

After the deal is signed, the Afghan government must assemble a negotiating team and navigate a planned prisoner exchange.

The Taliban provided U.S. negotiators a list of 5,000 Taliban prisoners currently held in detention by the Afghan government. And the militants announced 1,000 members of the Afghan security forces in Taliban captivity would be released in exchange.

“This is a test for the Americans,” said former senior Taliban official Abdul Salam Zaeef. “When this step is taken properly, then we’ll go to negotiations.” Afghan government officials have said that such an exchange would only occur during inter-Afghan talks or after they are complete.

Another potential obstacle after the deal is signed is the formation of an inclusive negotiating team to represent the Afghans who are not aligned with the Taliban. The announcement of disputed election results earlier this month has left the government in Kabul deeply divided and has the potential to undermine Ghani’s mandate to form that team.

An unofficial Afghan government delegation tried to meet Taliban officials in Doha Friday, but the Taliban declined the meeting. Suhail Shaheen, a Taliban spokesman, said “We have neither invited nor will meet the delegation,” according to Radio Mashaal.

A peace deal with the Taliban has been a critical foreign policy goal for President Trump, who campaigned on ending the war.

In a statement Friday, Trump called the deal “a powerful path forward to end the war in Afghanistan and bring our troops home.” But the president has faced fierce criticism from the Afghan government as well as from fellow Republicans at home.

Afghan officials have repeatedly criticized the United States for excluding them from talks with the Taliban. Any significant withdrawal of U.S. forces from the country is expected to place increased pressure on Afghan government forces, whose casualty rates continue to rise.

On Thursday, a group of Republican lawmakers released a letter warning that the Taliban has “a history of extracting concessions in exchange for false assurances.”

“A full-scale U.S. withdrawal” would “allow terrorist groups in Afghanistan to grow stronger and establish safe havens from which to plot attacks against us,” the letter continued.

Trump’s Friday statement said “ultimately it will be up to the people of Afghanistan to work out their future. We, therefore, urge the Afghan people to seize this opportunity for peace and a new future for their country.”

U.S. and Taliban negotiators were close to signing a peace deal in September, but the effort was scuttled by Trump after an attack by the Taliban killed a U.S. soldier.

Since then, chief U.S. negotiator Zalmay Khalilzad sought confidence-building measures to bring both sides back to the table. In November, the Taliban released two Western hostages in exchange for the release of senior militants linked to the Taliban by the Afghan government. And over the last week both sides reduced violence nationwide.

It is unclear if the reduction in violence will hold in the coming weeks as Afghan government officials and the Taliban begin talks. The Afghan government initially demanded a cease-fire before agreeing to talks with the Taliban.

As peace talks between the U.S. and the Taliban gained momentum last year, violence in Afghanistan intensified. The United Nations annual report on civilian casualties released this month said that in 2019 3,403 civilians were killed and 6,989 injured.

The United Nations Assistance Mission in Afghanistan has documented more than 100,000 civilian casualties since the organization began its tally in 2009.