The agreement to end the brutal U.S.-Taliban conflict in Afghanistan, which began nearly two decades ago with the 2001 terrorist attacks in New York and Washington and became America’s longest war, was signed on Saturday under the gaze of tough men in turbans, who clapped and shouted “Allahu akbar!”

President Trump hailed the accord, formalized with signatures and a handshake between U.S. negotiator Zalmay Khalilzad and his Taliban counterpart, Abdul Ghani Baradar, as historic. “There hasn’t been a moment like this,” Trump said at a White House news conference. “We’ve had very successful negotiations. . . . Everybody’s tired of war.”

Trump said he would be “meeting personally with Taliban leaders in the not too distant future.” Asked whether such a meeting would be overseas, or if he would invite them to Camp David, an idea he broached last year, he said, “We’re looking at that.”

Senior administration officials, while claiming success, offered slightly more tempered expressions of optimism.

“There will be a temptation to declare victory,” Secretary of State Mike Pompeo said at the signing ceremony, held at a hotel in Doha, the Qatari capital, and attended by a full contingent of Taliban as well as diplomats and other dignitaries. “Victory for Afghans will only be achieved when they can live in peace and prosper. Victory for the United States will only be achieved when Americans and our allies no longer have to fear a terrorist threat from Afghanistan.”

The agreement, after 10 years of on-and-off talks with the Taliban, follows months of intense negotiations, in which the Afghan government did not participate.

Many veterans of the years-long efforts to end the war and leave a stable Afghanistan, as well as Trump supporters, questioned whether the new agreement laid a sturdy groundwork for permanent peace. Some described it as a capitulation to the Taliban, whose primary demand has always been the full departure of foreign troops.

One former senior defense official, speaking on the condition of anonymity because of the matter’s extreme sensitivity, said that some senior military and intelligence officials “are concerned that the administration is putting too much stock in the promises of the Taliban,” who will “simply sign anything to get us to leave.”

The most tangible part of the U.S.-Taliban deal is a 14-month deadline for complete withdrawal of U.S. and allied forces. While Pompeo and Defense Secretary Mark T. Esper emphasized that the departure is “conditions-based,” the conditions in the agreement appeared to relate far more to the insurgents’ promises to stop attacking the Americans as they leave, and to sever ties with other terrorist groups, rather than a long-term solution for Afghans.

“The conditionality piece appears far too ambiguous to take any comfort in it,” said Daniel Feldman, who served in the State Department’s office for Afghanistan and Pakistan from 2009 to 2015, and served as its head from 2014 to 2015.

The agreement includes a Taliban commitment to start direct negotiations with the Afghan government over a cease-fire and political settlement of the war within 10 days. Those negotiations, tentatively to be held in Norway, are already complicated by political upheaval in Kabul, where President Ashraf Ghani’s recent reelection is under challenge and there are major fights over the composition of a negotiating team. The agenda for the talks is massive, including a comprehensive cease-fire, the role of the Taliban in a future government, and rights for women and civil society. No format has been established, and there is no deadline for completion.

“All of the conditions in Afghanistan militate against a successful peace process,” said James Dobbins, who served as special envoy for Afghanistan during the Bush and Obama administrations. “There is no impartial U.N. force, no impartial monitor” to affirm compliance and disarmament. “On the government side, there are deep divisions that make it hard to negotiate. And they have a bunch of interfering neighbors,” Dobbins said.

“The fact that we could fully withdraw before any sort of negotiated settlement is finalized — let alone implemented — between the Taliban and the Afghan government,” Feldman said, “leaves us with virtually no leverage to help ensure that Afghanistan is on a sustainable and peaceful path, and particularly imperils the gains that women and civil society have made there.”

“I both want to be supportive of [Khalilzad’s] efforts, which I think are the best he could have gotten under the circumstances . . . while also being pretty clear-eyed about everything this is not,” Feldman said. “It’s not a resolution of the Afghan conflict. It’s just a resolution of the U.S. presence.”

The firm withdrawal date is one of the few public additions to an agreement that originally was drafted in September, but was canceled by Trump after a U.S. soldier was killed in a Taliban attack. Negotiations began again late last year, even as the president launched his reelection campaign with a renewed promise to stop the United States’ “endless wars.”

Trump “wants to get troops out of wherever we are,” said Ryan Crocker, the senior U.S. diplomat who opened the U.S. Embassy in Kabul in 2003 and then served as ambassador in Pakistan and Iraq, and in Afghanistan before his 2009 retirement. Khalilzad, he said, was told: “If you want to go try to cut a deal, be my guest, but the time is not infinite.”

“The withdrawal provisions in this Afghanistan agreement seem far more comprehensive than advertised. It’s a TOTAL withdrawal of ALL American and NATO forces within 14 months,” Brett McGurk, the administration’s former special representative to the coalition against the Islamic State, said on Twitter. “That would likely produce a gradual collapse of the state, civil war, and the Taliban back in Kabul.”

U.S. officials have said repeatedly in recent months that their goal was for a residual force of U.S. Special Operations troops to remain in Afghanistan to fight the Islamic State and other groups. But while Esper, Pompeo and others referred to the continuation of U.S. counterterrorism operations, there is no specific reference to that residual component in the agreement.

The agreement also provides for the “expeditious” release by March 10 of up to 5,000 Taliban prisoners and up to 1,000 prisoners held by “the other side,” and the release of all remaining prisoners within the subsequent three months. It does not mention whether “the other side” includes Taliban prisoners being held by the United States. including some at the detention facility in Guantanamo Bay, Cuba.

Warning that the agreement could threaten the security of the United States, Rep. Liz Cheney (R-Wyo.) said in a statement that “releasing thousands of Taliban fighters, lifting sanctions on international terrorists, and agreeing to withdraw all U.S. forces in exchange for promises from the Taliban, with no disclosed mechanism to verify Taliban compliance, would be reminiscent of the worst aspects of the Obama Iran nuclear deal.”

Cheney sharply questioned Esper and Gen. Mark A. Milley, chairman of the Joint Chiefs of Staff, at a Thursday hearing about reports of “secret annexes” to the peace deal, including direct counterterrorism cooperation with the United States. Both demurred but pledged to brief Congress on the agreement.

“If verification mechanisms exist, the Secretary of State should immediately make them, and any other side deals or annexes, public,” Cheney said Saturday. “The American people deserve to know precisely what deals have been cut in our name with the terrorists who harbored those who attacked us on 9/11,” Cheney said.

John Bolton, Trump’s former national security adviser, called the deal “an unacceptable risk to the United States’ civilian population. This is an Obama-style deal,” he said in a tweet. “Legitimizing Taliban sends the wrong signal to [the Islamic State] and al-Qaeda terrorists, and to America’s enemies generally.”

“Everyone I talk to frankly has mixed feelings,” Rep. Michael Waltz (R-Fla.), a former Green Beret, said in a Fox News interview. “Here’s my worry. . . . It has a timeline in there, 14 months. . . . This could get worse, much worse.”

At his news conference, Trump indicated that the Taliban would take over the fight against the Islamic State and others, although the agreement, and a separate joint declaration with the Afghan government, cite only Taliban responsibilities for preventing terrorist groups from activities within territory under Taliban control.

“They will be killing terrorists,” Trump said, “killing some very bad people. . . . We very much hope they will be doing what they said.”

Under the deal, an initial U.S. withdrawal, totaling about one-third of the 12,000 Americans deployed to Afghanistan, is due within 135 days, followed by the “complete withdrawal of all remaining forces” within the following nine-and-a-half months.

“I really believe the Taliban wants to do something to show that we’re not all wasting time,” Trump said. If “bad things happen, we’ll go back . . . so fast, with a force like nobody’s ever seen. I don’t think that will be necessary. I hope it’s not necessary.”

“Look, nobody should be criticizing this deal after 19 years. . . . We should never have gotten in in the first place,” he said.

Dan Lamothe in Kabul, and Anne Gearan, Carol Morello and Missy Ryan contributed to this report.