WASHINGTON — President Donald Trump's decision to withdraw American troops from Syria was made hastily, without consulting his national security team or allies, and over strong objections from virtually everyone involved in the fight against the Islamic State, according to U.S. and Turkish officials.

Trump stunned his Cabinet, lawmakers and much of the world with the move by rejecting the advice of his top aides and agreeing to a withdrawal in a phone call with Turkish President Recep Tayyip Erdogan last week, two officials briefed on the matter said.

The Dec. 14 call, described by officials who were not authorized to discuss the decision-making process publicly and spoke on condition of anonymity, is a view into a Trump decision with profound consequences, including the resignation of widely respected Defense Secretary Jim Mattis.

The White House, State Department and Pentagon all declined to comment on the account of the withdrawal decision.

U.S. troops first moved into Syria in 2015 to fight the Islamic State group, a year after the Pentagon first launched a campaign of airstrikes against the extremists in Iraq and Syria. Local ground forces with close U.S. support slowly pushed back IS in the years that followed and by the beginning of 2018, the extremists had lost more than 90 percent of the territory they once held.

Despite losing the physical caliphate, thousands of IS fighters remain in Iraq and Syria and the group continues to carry out insurgent attacks. Local commanders warn the group could easily move back into territory it once held if American forces completely withdraw.

Secretary of State Mike Pompeo arranged the Dec. 14 call a day after he had unsuccessfully sought clarity from Turkish counterpart Mevlut Cavusoglu about Erdogan's threats to launch a military operation against U.S.-backed Kurdish rebels in northeast Syria, where American forces are based.

Pompeo, Mattis and other members of the national security team prepared a list of talking points for Trump to tell Erdogan to back off, the officials said.

But the officials said Trump, who had previously accepted such advice and convinced the Turkish leader not to attack the Kurds and put U.S. troops at risk, ignored the script. Instead, the president sided with Erdogan.

The officials said the conversation set off a frantic, four-day scramble to convince the president either to reverse or delay the decision to give the military and Kurdish forces time to prepare for an orderly withdrawal. Trump, however, was unmoved, they said.

"The talking points were very firm," said one of the officials, explaining that Trump was advised to clearly oppose a Turkish incursion into northern Syria and suggest the U.S. and Turkey work together to address security concerns. "Everybody said push back and try to offer (Turkey) something that's a small win, possibly holding territory on the border, something like that."

Erdogan, though, quickly put Trump on the defensive, reminding him that he had repeatedly said the only reason for U.S. troops to be in Syria was to defeat the Islamic State and that the group had been 99 percent defeated. "Why are you still there?" the second official said Erdogan asked Trump, telling him that the Turks could deal with the remaining IS militants.

With Erdogan on the line, Trump asked national security adviser John Bolton, who was listening in, why American troops remained in Syria if what the Turkish president was saying was true, according to the officials. Erdogan's point, Bolton was forced to admit, had been backed up by Mattis, Pompeo, U.S. special envoy for Syria Jim Jeffrey and special envoy for the anti-ISIS coalition Brett McGurk, who have said that IS retains only 1 percent of its territory, the officials said.

Bolton stressed, however, that the entire national security team agreed that victory over IS had to be enduring, which means more than taking away its territory.

Trump was not dissuaded, according to the officials, who said the president quickly capitulated by pledging to withdraw, shocking both Bolton and Erdogan.

Caught off guard, Erdogan cautioned Trump against a hasty withdrawal, according to one official. While Turkey has made incursions into Syria in the past, it does not have the necessary forces mobilized on the border to move in and hold the large swaths of northeastern Syria where U.S. troops are positioned, the official said.

The call ended with Trump repeating to Erdogan that the U.S. would pull out, but offering no specifics on how it would be done, the officials said.

Over the weekend, the national security team raced to come up with a plan that would reverse, delay or somehow limit effects of the withdrawal, the officials said.

On Monday, Bolton, Mattis and Pompeo met at the White House to try to plot a middle course. But they were told by outgoing chief of staff John Kelly and his soon-to-be successor Mick Mulvaney that Trump was determined to pull out and was not to be delayed or denied, according to the officials. The trio met again on Tuesday morning to try to salvage things, but were again rebuffed, the officials said.

The White House had wanted to announce the decision on Tuesday — and press secretary Sarah Sanders scheduled a rare briefing specifically to announce it. But the Pentagon convinced Trump to hold off because the withdrawal plans weren't complete and allies and Congress had not yet been notified, according to the officials. The first country aside from Turkey to be told of the impending pull-out was Israel, the officials said.

Word of the imminent withdrawal began to seep out early Wednesday after U.S. Central Command chief Gen. Joseph Votel started to inform his commanders on the ground and the Kurds of the decision.

Following the official announcement the White House emphasized that the U.S. will continue to support the fight against IS and remains ready to "re-engage" when needed. But in a tweet, the president said U.S. troops would no longer be fighting IS on behalf of others.

"Time to focus on our Country & bring our youth back home where they belong!"