President Trump met Friday with his top security officials to try to figure out how to withdraw from Afghanistan, where the US has been mired in fighting since the months after 9/11.

Team Trump is considering a phased withdrawal of about 5,000 of the 14,000 US troops in the war-torn country — a move opponents say could lead to the Taliban regaining control.

Trump had planned a sitdown with cabinet officials and other senior national security advisers for a briefing by Zalmay Khalilzad, the chief US envoy to the talks between the Islamic radicals and the US-backed Afghan government.

Vice President Mike Pence and Secretary of State Mike Pompeo were also expected at the meeting at Trump’s New Jersey golf resort, where he has spent most of the past week.

Khalilzad is back in the States from his negotiations with the Taliban in Qatar, talks he has described as “productive,” though no deal was made.

The two sides have been discussing an agreement in which the US withdraws in exchange for the Taliban promising that Afghanistan does not become a haven for terrorists and al Qaeda, as it was before the US invasion in 2001.

The US wants a cease-fire, but so far the insurgents have refused to recognize the Afghan government, dismissing it as a US puppet.

Meanwhile, there are fears that a deal would hand the country over to the Taliban.

“To trust the Taliban to control al Qaeda, ISIS-K, and other radical Islamist groups present in Afghanistan — as a replacement for a US counter-terrorism force — would be a bigger mistake than Obama’s Iranian nuclear deal,” said Sen. Lindsey Graham (R-SC), normally a reliable Trump supporter.