President Donald Trump has ordered the U.S. military to withdraw up to half of its 14,000 troops from Afghanistan, officials say.

The Pentagon is developing plans to withdraw the troops, marking a sharp change in the Trump administration's policy aimed at forcing the Taliban to the peace table after more than 17 years of war, according to U.S. officials.

One official says the troops could be out by summer, but no final decision has been made.

Another official, speaking on the condition of anonymity, said a decision had been made and verbal orders had been given to start planning for the drawdown. The official said timelines were being discussed but it could happen in weeks or months.

President Donald Trump reportedly ordered the drawdown in Afghanistan at the same time he decided to pull all troops out of Syria

The decisions are thought to have led to the resignation of Defense Secretary Mattis, who is seen above at the beginning of the war in late 2001 when he was a Marine brigadier general

On Wednesday, Trump rebuffed top advisers and decided to pull all U.S. troops out of Syria, a decision that contributed to U.S. Defense Secretary Jim Mattis abruptly quitting on Thursday over significant policy differences with the president.

Trump made the decision to draw down in Afghanistan and pull out of Syria at the same time, one official told the New York Times.

Trump has long pressed to pull troops out of Afghanistan, but was persuaded by Mattis and others to keep them there to pressure the Taliban and battle a stubborn Islamic State insurgency.

Officials say the latest White House push for withdrawal was another key factor in Mattis' decision to resign Thursday.

The officials spoke on condition of anonymity to discuss internal deliberations.

It is unclear how the United States with less than 9,000 forces in Afghanistan will be able to fulfill the full set of missions now underway, including training Afghan forces, advising them in the field, and waging an air campaign against the Taliban and other militant groups.

Instead, the United States almost certainly would have to curtain its missions, something that could provide an opportunity for a resurgent Taliban to expand their offensives across Afghanistan.

Mattis had argued for maintaining a strong U.S. military presence in Afghanistan to bolster diplomatic peace efforts. He resigned shortly after U.S. officials raised the possibility that Trump would order the drawdown.

The decision on Syria has bewildered U.S. allies and triggered harsh reaction from Trump's fellow Republicans in Congress.

The Pentagon declined to comment on Afghanistan.

Fighters with Afghanistan's Taliban militia stand on a hillside at Maydan Shahr in Wardak province, west of Kabul, in 2008. A US drawdown could allow the Taliban to expand

US soldiers are seen at Forward Operating Base (FOB) Connelly in the eastern Afghan province of Nangarhar in 2015. Some 2,400 American troops have died in the 17-year war there

Garrett Marquis, a spokesman for the National Security Council, said the White House would not comment 'on future strategic developments.'

The United States went to war in Afghanistan in 2001 in the wake of the Sept. 11, 2001 attacks on the World Trade Center and the Pentagon, seeking to oust the Taliban militants harboring Saudi-raised militant Osama bin Laden, who led plans to carry out the attacks.

U.S. officials are currently engaged in talks with the Taliban, who now control a significant amount of territory. The Taliban insurgency has strengthened its grip over the past three years, with the government in Kabul controlling just 56 percent of Afghanistan, down from 72 percent in 2015, a U.S. government report showed.

Trump privately has been grousing about U.S. military involvement in Afghanistan, telling an ally as recently as Wednesday words to the effect of, 'What are we doing there? We've been there all these years.'

The source, who asked to remain unidentified, said it appeared the president 'has lost all patience' with the U.S. military presence in Afghanistan.

More than 2,400 U.S. forces have died in the 17-year-old war in Afghanistan, and Pentagon officials have repeatedly warned that a precipitous exit would allow militants to develop new plots on America.

Republican Senator Lindsey Graham, often a vocal Trump ally, warned of possible danger to the United States if the drawdown goes through.

'The conditions in Afghanistan - at the present moment - make American troop withdrawals a high risk strategy. If we continue on our present course we are setting in motion the loss of all our gains and paving the way toward a second 9/11,' Graham said in a statement.

Trump last year approved an increase in U.S. troops but acknowledged that he did so reluctantly.

Late last month, at least 22 Afghan police were killed in a Taliban ambush in Afghanistan's western province of Farah, adding to the growing casualty toll on Afghan security forces.

Earlier this week, U.S. special envoy Zalmay Khalilzad and Taliban representatives held talks in Abu Dhabi on a deal that would end the war. Officials from Saudi Arabia and the United Arab Emirates also took part.

The Saudi ambassador to Washington, Khalid bin Salman, tweeted on Thursday that the discussions had been productive and would bring 'very positive results by the beginning of next year.'

But a former senior State Department official familiar with the issue said that the Taliban representatives rejected a proposal by Khalilzad for a ceasefire and demanded that the talks focus on a U.S. withdrawal.