The best hope for an end to the 18-year war in Afghanistan may lie in a sumptuous conference room in Doha’s Diplomatic Club in Qatar. But there may be only one person who knows whether a paper peace deal negotiated there will translate into actual peace on the ground in the long-suffering country 1,000 miles to the northeast: U.S. envoy Zalmay Khalilzad.

For more than a year, Khalilzad has worked to end America’s fight with the Taliban, using the club and nearby five-star hotels as a kind of ad hoc headquarters. Now Khalilzad is confident he’s on the brink of inking an elusive peace deal between Washington and the militants that sheltered Al Qaeda terrorists while they plotted the attacks of 9/11. He’s so confident, in fact, that his team is already sizing up venues for a signing ceremony, according to Afghan and western officials.

If Khalilzad succeeds, he will deliver a pivotal election-year victory for his boss, President Donald Trump, who has long pledged to end America’s involvement in “endless wars.” If he fails, the U.S. will remain mired in the longest war in American history, a conflict that has killed more than 3,500 U.S. and NATO troops, cost U.S. taxpayers nearly $900 billion, and left thousands of Afghans dead and millions more displaced.

The difference hangs on the convoluted details Khalilzad has hammered out over months shuttling between Doha, Kabul, and Washington, drinking endless cups of tea and flattering, cajoling, and lecturing top players on all side.

At its heart, Khalilzad’s deal offers this basic bargain: the Taliban will reduce its violent attacks on U.S. and Afghan troops, and the U.S. will withdraw much its forces from the country. The Taliban has agreed to a seven-day “reduction in violence” to show that it’s serious. But, crucially, its leaders will not agree in public to the U.S. demand to keep counterterrorism forces in Afghanistan.

To get past that roadblock, Khalilzad has come up with a rickety workaround. The deal contains secret annexes, according to three people familiar with details of the current draft. The first is an agreement for U.S. counterterrorism forces to stay in the country. The second is a Taliban denouncement of terrorism and violent extremism. The third annex contains a mechanism to monitor whether all sides are honoring the semi-truce while talks between warring Afghan parties proceed, according to two of the sources, and the last addresses how the CIA will operate in future in Taliban-controlled areas.

Details of the secret annexes were provided in writing to TIME by one of the sources, who insisted on anonymity to disclose details of the confidential talks. A U.S. lawmaker and two Afghan officials confirmed that a long-term counterterrorism force numbering 8,600 U.S. troops, down from the current 13,000, is part of the deal. The State Department and Khalilzad’s office declined to comment, as did the CIA. Khalilzad declined to be interviewed for this article. A Taliban official insisted Thursday that the deal requires a full U.S. troop withdrawal and said that talk of secret annexes were just rumors.

The deal could be signed by the end of the month, according to U.S. and Afghan officials, if everyone stays on board. But a lot can happen in two weeks. Secretary of State Mike Pompeo still has to meet Afghan President Ashraf Ghani, who has never been a fan of Khalilzad’s plan. Taliban ground forces could catch wind that their leaders have covertly agreed to let some U.S. forces stay and launch a new, destabilizing attack. Or Trump could tap out a damaging tweet—and send his envoy back to the negotiating table.

For Afghanistan, where an entire generation has grown up during the war, the stakes couldn’t be higher. For Khalilzad, or “Zal,” has he’s widely known, it would be the deal of a lifetime. Even if peace doesn’t last, Khalilzad can say he has done his part, cementing his status as a dealmaker by delivering an agreement once thought to be impossible.

ZAL HAS COME CLOSE BEFORE. Last September, a U.S.-Taliban deal seemed imminent when it was derailed by a Taliban bombing in Kabul that killed several people, including a U.S. soldier. Trump abruptly called off peace talks in an on-brand tweetstorm on Sept. 7, putting Khalilzad’s coveted deal on ice for months. The talks resumed in December, and this week officials say the deal is again ready to sign—if the Taliban can stop its members from attacking U.S. and Afghan forces for a full seven days.

That’s a big ‘if.’ The Taliban has had trouble in the past maintaining control among its factions, some of which may be disappointed by a deal that fails to deliver a total U.S. withdrawal. Two U.S. soldiers were killed on Saturday when an assailant dressed in an Afghan army uniform opened fire with a machine gun, bringing to six the number of service members killed in Afghanistan this year. The Taliban pointedly did not take responsibility for killing the troops on Saturday.

The secret annexes could also complicate the deal’s ability to deliver lasting peace. The Taliban rank and file will expect to see all American troops packing up and leaving, but it will become apparent by year’s end that U.S. forces are not going down to zero. “If the Taliban make these agreements known, they will melt down, and fade away,” one of the sources briefed on the draft said, speaking on condition of anonymity to discuss the sensitive deal. ”So they keep it secret.”

In some ways the rickety deal is classic Khalilzad. Resembling a gracefully aging Hollywood character actor, the nearly six-foot-tall 69-year-old favors tailored dark suits and slicked-back grey hair. Afghan-born and U.S. educated, Khalilzad served as one of the first U.S. ambassadors to post-9/11 Afghanistan.

Khalilzad’s allies say he is a wily and skillful negotiator who brings a rare combination of regional experience, ambition, charisma and healthy cynicism to the job—and perhaps a measure of bruised pride that his decades of diplomacy have failed to deliver prosperity or stability to the country of his birth.

But his detractors in Washington worry that he’ll say anything to anybody to get them to sign off on a deal for Trump, whether or not it’s built to last. In Kabul, he’s equally controversial, seen by some as a potential political competitor with ambitions to run for the Afghan presidency. As a Sunni Muslim from the Pashtun tribe, which most Taliban members also belong to, many non-Pashtun Afghans simply don’t trust him.

Khalilzad was born in 1951 in a modest neighborhood in Mazar-i-Sharif, Afghanistan, then a bustling hub of politics and commerce for “Afghan Turkistan” as the area close to the Uzbek border was known. His father was a mid-level civil servant, and his mother married very young and gave birth to 13 children. Only seven survived, including Zal, who got his first taste of life outside Afghanistan as a high school exchange student in California, where he perfected his English practicing in front of the mirror, according to his memoir, The Envoy. He was pulled into the neocon movement in the U.S. while earning his Ph.D. at the University of Chicago in 1979, and has since held senior positions in the administrations of Ronald Reagan, George H. W. Bush, and George W. Bush.

After the 9/11 attacks prompted the U.S.-led invasion of Afghanistan that drove the Taliban from power for hosting al-Qaeda, Khalilzad played a key role in selecting Hamid Karzai as Afghanistan’s next leader. At the 2001 Bonn International Conference, Afghan delegates had first chosen a respected official from the Afghan king’s rule, seen by many as a golden age of equality among the country’s Pashtun, Tajik and other tribes, according to a western official and a former Afghan official who took part.

After 48 hours of arm twisting, Khalilzad convinced the delegates the leader had to be Pashtun—Afghanistan’s largest ethnic group—to unite the country. Specifically, it had to be Karzai. “He gets his way,” griped one Western official who had backed the former royal official as more likely to unite the country.

KHALILZAD HAS TRUMP’S FULL SUPPORT to close this deal, Zal’s allies say. He was one of the few prominent Bush Republicans who endorsed Trump’s run for the highest office early on, by introducing him at a 2016 event sponsored by the publication National Interest. At the time, others he’d served with were signing “Never Trump” letters, a former senior U.S. official recalls, marking it as Khalilzad’s early gambit for a senior role on Team Trump.

Secretary of State Mike Pompeo recommended Khalilzad for the peace envoy job, telling the President that he knew the players and had pulled off tough negotiations before. “Zal sold himself to the President as the only guy who could negotiate with the Taliban because of his Afghan heritage, his deal making skills, and his relationships with powerful figures in the country,” says a former official who served in the country.

The talks commenced in the fall of 2018, regularly held beneath the palatial arches of Doha’s dune-colored Diplomatic Club, overlooking the Persian Gulf. Zal convinced the Taliban to talk by agreeing to separate the U.S. peace talks from negotiations with Afghan government, which the Taliban considers to be invalid. The U.S. and Taliban would agree on the conditions for a ceasefire and troop withdrawal; the Afghan talks determining the future of Afghanistan would come later.

Even that deferral of a lasting peace deal required a questionable workaround. Khalilzad got the Taliban to talk with Afghan government officials only by arranging the creation of an intra-Afghan committee of community leaders with whom formal talks would be held. Afghan government officials would attend those talks only in a personal capacity.

Afghan officials have complained the indirect structure shows the U.S. envoy bending over backwards for the militants, instead of demanding that they officially recognize the elected government of the Afghan Republic.

Ghani, the Afghan president, is biding his time, letting this chapter play out rather than play spoiler, one senior Afghan official says. For now, he has designated delegates to join the intra-Afghan committee talks to determine the shape of a future Afghan government, and what the Taliban’s role in it will be. Ghani, and most of the population according to recent polls by the Asia Foundation, want the country to remain a democracy. The Taliban have made no secret they want to return to being an “Emirate” where religious authorities have greater power.

In early conversations with Afghan delegates including women in Doha, the Taliban have said they would support women’s rights, allowing them to be educated and to work outside the home. But that hasn’t been the practice in some parts of Afghanistan now under their sway. Longtime Taliban watchers also doubt the group will follow through with a pledge made as part of the talks to break with Al Qaeda—the terrorist group is now literally family, with many members having married into Afghan tribes in the decades of fighting U.S. troops after 9/11.

Former senior CIA officer Douglas Wise, who served twice in Afghanistan, says the Taliban’s ultimate goal is to reclaim the power it held before the U.S. invasion that followed 9/11. “If you look at the Taliban’s strategic goals, it is to return to power, to expel the Western-imposed expatriate, Afghan-run government and to recreate the ‘Islamic Emirate of Afghanistan,’” as the Taliban still describes itself. Wise, the former deputy chief of the Defense Intelligence Agency, gives little credence to Taliban pledges to respect human and women’s rights. “That’s all BS. They will say anything to get us an agreement to get us to leave. Whatever it takes to get the Americans out.”

Ghani and his advisors evince similar skepticism. They believe the Taliban will have trouble maintaining a future “reduction of violence” during intra-Afghan talks. If violence breaks out, and if Ghani survives opposition challenges to the September election that narrowly gave him another five years in office, his government will abandon the talks and reach out to individual Taliban factions, offering one-off deals to divide and conquer the oft-squabbling tribes.

That would be just fine for Khalilzad and Trump, who could argue that failure of the intra-Afghan talks, or even a full return to Taliban control, would be on the Afghan government, not on Washington.

In the end, critics and admirers alike say that Zal is in it for Zal. That’s why those who trust him say he will deliver this week, with his eyes fixed on a diplomatic prize that could enshrine his name in the history books for bringing troops from his adopted country home. “Never forget,” said one U.S. official who knows Khalilzad well. “Zal is relentless.”

Correction, Feb. 14

The original version of this story misstated the location of Afghanistan in relation to Doha, Qatar. It is 1,000 miles to the northeast, not northwest.

Correction, Feb. 15

The original version of this story also misstated when peace talks began. They began in the fall of 2018, not 2019.

Get our Politics Newsletter. The headlines out of Washington never seem to slow. Subscribe to The D.C. Brief to make sense of what matters most. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.