WASHINGTON – President Donald Trump has told his advisers that he wants to pull all U.S. troops out of Afghanistan by the November 2020 presidential election, according to five current and former administration and military officials.

The president's advisers are now scrambling to meet his election-year deadline, which has exacerbated tensions between officials at the Pentagon and the State Department over the timing of withdrawal and whether it should be completed, the officials said.

"It's tense," said one former official briefed on the debate.

Last December Trump threatened not only to immediately withdraw all troops from Afghanistan but also to shut down the U.S. embassy in Kabul, complaining to aides that it is too large and expensive, according to officials. The president's threat to close the U.S. embassy — which has not been previously reported — so alarmed administration and military officials that they quickly offered him a plan to move up the timing of efforts to scale back the size of the embassy staff, officials said.

"He was fed up with hearing that the U.S. was not winning there," one former U.S. defense official said. "It was no secret he wanted out, but deciding to pull out of the embassy, too, was a shock."

But Trump argued that without a military presence U.S. embassy staff could be in danger, so it should be closed, the officials said. He also said it was time for the U.S. to get out of the war there otherwise it could bankrupt the U.S. like it did Russia in the 1980s, the two former defense officials said.

A Pentagon spokesman said the department doesn't comment on military planning. The American troop presence in Afghanistan is conditions-based, the spokesman added.

Trump, when asked to specify how many troops will be pulled out of Afghanistan, said Friday: "We're reducing it. We've been there for 19 years. We're really serving as policemen. We could win Afghanistan in two days or three days or four days if we wanted, but I'm not looking to kill 10 million people."

Trump, who promised during his 2016 campaign to end wars like the one in Afghanistan, has expressed frustration since his early days in office with a lack of progress there. Those frustrations boiled over late last year after the Chairman of the Joint Chiefs of Staff Gen. Joseph Dunford suggested in November 2018 that the war wasn't going well.

In response to a question about whether the Taliban is winning in Afghanistan, Dunford replied: "They are not losing right now."

Over the next few weeks, Trump vented to aides that he had given in to increasing the U.S. military presence in Afghanistan in August 2017, and if they couldn't win by now it was time to get every American out, including at the embassy. Just days before Christmas, the president gave the directive for the immediate removal of 7,000 U.S. troops, roughly half of the total number in Afghanistan, and for the remaining 7,000 to be out over a matter of months, the former defense officials said.

The president's aides convinced him to backtrack on his directive to immediately begin troop withdrawal, promising an eventual Afghan peace deal that would achieve a drawdown. And in the following months the State Department began a so-called "right-sizing" exercise to cut the embassy staff by as much as half, according to a congressional staffer. It's expected to be complete by the end of September.

With the 2020 campaign ramping up, tensions have flared among Trump's advisers amid pressure to begin withdrawing troops and meet the president's goal by next year, the officials said. The president also is likely to face questions about whether a withdrawal from Afghanistan — which has bipartisan support including among some of his possible Democratic opponents — is driven by his re-election or U.S. national security interests. The president could face criticism from his opponent next fall about any outcome — that American troops are still in Afghanistan or that he withdrew in a way that harms U.S. national security.

Military leaders — including the commander of U.S. forces in Afghanistan, Gen. Scott Miller — have argued against withdrawing all American troops within the next 15 months, the five current and former officials said. Officials familiar with Miller's thinking say he is open to withdrawing a significant number of troops, but wants to maintain a U.S. military presence to take on ISIS or any al Qaeda remnants in Afghanistan.

Other top U.S. officials, particularly at the State Department, are concerned, however, that Trump will abruptly remove all troops out of Afghanistan if there's no movement on a plan for withdrawal, the officials said.

A person familiar with the internal debate said Pompeo has backed a full withdrawal from Afghanistan while National Security Adviser John Bolton has sided with the military in supporting keeping a small troop presence there.

The National Security Council declined to comment on the record.

"There is no deadline for the American mission in Afghanistan," a senior administration official said in a statement. "The president has been clear that, as we make progress on the peace process, we will begin to scale back our troop presence."

A State Department spokesperson did not comment on President Trump’s call to close the embassy late last year. The spokesperson did confirm the Department is in the midst of a review of the size of the Embassy in Kabul, but said the US Mission in Kabul has long been the largest mission in the world and even with a substantial cut it will continue to one of the largest.

“We intend to consolidate the US presence while maintaining personnel and programs essential to protect core US national security interests,” the spokesperson said.

In attempt to meet Trump's deadline, the envoy Pompeo appointed to negotiate a peace agreement, Zalmay Khalilzad, is aiming for a framework for a deal that gets the Afghan government and the Taliban to hold talks by September. A drawdown of troops, which officials say will be based on conditions on the ground, is to be part of a peace deal.

A U.S. intelligence assessment says the Taliban does not want al Qaeda to have a safe haven in Afghanistan and is likely to try to keep the terror group out of the country once a peace agreement is in place, according to two U.S. officials familiar with the assessment. But the intelligence assessment also says the Taliban are not likely to hold up their end of a deal with the U.S., the officials said.

Pompeo, when asked earlier this week if he expects the U.S. to reduce its troop presence in Afghanistan before the 2020 election, said: "That's my directive from the president of the United States."

Miller returned to Washington in recent days for meetings that officials said are meant to get everyone on the same page as the president, according to a current and former U.S. defense official

The current debate and disagreements among Trump's advisers over the war in Afghanistan — which began 18 years ago this fall — is similar to those that the two previous administrations have had.

On Monday, two U.S. soldiers were killed in Afghanistan, an apparent attack by a member of the Afghan Security Forces they were helping to train. So far this year, 15 American service members have died while serving in Afghanistan — the same number who died there in all of 2018.