In his first Cabinet meeting of the year, President Trump stuck a dagger in a major initiative advanced by his foreign policy team: Iran’s leaders, the president said, “can do what they want” in Syria.

With a stray remark, Trump snuffed out a plan from his national security adviser, John Bolton, who this fall vowed that the United States would not leave Syria “as long as Iranian troops are outside Iranian borders.”

The president’s statement offered the latest illustration of the dramatic gyrations that have characterized his foreign policy and fueled questions about whether his senior advisers are implementing his policies or pursuing their own agendas.

The president’s order last month to withdraw troops from Syria, which prompted the resignation of Defense Secretary Jim Mattis, had already exposed a stark gap between Bolton’s plan to use the country as a theater to push back against Iran and the president’s eagerness to wash his hands of the war.

Critics say the shifting plan, which has rattled key U.S. allies, will embolden Russia and Iran, the Syrian government’s main foreign supporters. It also sets the stage for a confrontation between NATO ally Turkey and Kurdish-dominated Syrian forces that have been the chief U.S. partner against the Islamic State.

Trump, during wide-ranging comments alongside Cabinet officials Wednesday, reiterated his intent to exit Syria as military officials scrambled to arrange a departure for the more than 2,000 troops there.

On Thursday, Bolton discussed plans to hand the Islamic State mission over to Turkish forces with Secretary of State Mike Pompeo, acting defense secretary Patrick Shanahan and Gen. Joseph F. Dunford Jr., chairman of the Joint Chiefs of Staff, in a meeting at the Pentagon.

Military officials have voiced deep reservations about the speedy departure at a moment when the extremists, though severely weakened, remain a potent threat and Turkey continues to prioritize its fight against the U.S.-backed Syrian Democratic Forces (SDF), which it considers part of a Kurdish terrorist group, over the battle against the Islamic State.

Senior officials are expected to gather at the White House in coming days to decide what support the United States might provide to Turkish forces and to the SDF. Early next week, Bolton and Dunford will visit Turkey to discuss the transition plans with leaders there.

Absent from the discussions in Washington, U.S. officials familiar with Syria policy said, is the Iran-centric plan that Bolton and Pompeo unveiled in the fall. Officials attributed that to the fact the president never signed off on an expanded U.S. mission in Syria to counter Iran in the first place.

“That Iran strategy was never endorsed by the president,” said a U.S. official, who like others spoke on the condition of anonymity to discuss sensitive policy details.

While Trump shares his advisers’ combative views on Iran, he has focused mainly on the 2015 nuclear deal, which he pulled out of earlier this year. Pompeo and Bolton, meanwhile, have taken a broader view and advocated new actions to rein in Iran’s support for proxy groups.

Late last year, some of the president’s hawkish advisers drafted a memo committing the United States to a longer-term presence in Syria that included goals of an enduring defeat of the Islamic State, a political transition and the expulsion of Iran, officials said. The president has not signed the memo, which was presented to him weeks ago.

In fact, Trump had warned his aides for months that he wanted out of Syria in short order. But Bolton and Pompeo, apparently believing like other officials across the government that the president had softened that demand, continued to relay bold plans for the country ahead of the surprise withdrawal announcement.

“Defeating ISIS, which was once our primary focus, continues to be a top priority, but it will now be joined by two other mutually reinforcing objectives,” Pompeo said in October. “These include a peaceful and political resolution to the Syrian conflict and the removal of all Iranian and Iranian-backed forces from Syria.”

On Thursday, Pompeo acknowledged that American forces were leaving but insisted that the United States would continue its mission of countering the Islamic State and Iran. “The counter-Iran campaign continues,” Pompeo told news outlet Newsmax. “We’ll do all of those things. . . . We will simply do it at a time when the American forces have departed Syria.”

Robert Ford, a former U.S. ambassador to Syria, said a well-functioning National Security Council would typically straighten out the dissonance between the president’s wishes and those of the Pentagon and State Department. In this case, Bolton continued to push forward despite the conflicting views.

“Bolton got way out ahead of the policy, and it’s his job to understand what the president wants,” said Ford, now a fellow at the Middle East Institute. “When the president is nervous or cautious about something, it’s the NSC’s job to relay that back to State and the Pentagon, and warn them not to go too far. Apparently they didn’t get the message.”

Bolton, Trump’s third national security adviser, has advanced steps in keeping with the two men’s shared hostility to multilateral institutions like the United Nations, but his expansive view on the use of U.S. military power has appeared to conflict with the president’s instincts.

A White House official, speaking on the condition of anonymity, said the United States would use “a range of tools of national power,” including sanctions and diplomatic pressure, to continue pressing Tehran to pull its forces out of Syria.

“Iran knows the U.S. stands ready to re-engage at all levels to defend American interests,” the official said.

Bolton’s Iran plan never really took effect at the Pentagon, where officials were not officially tasked with any new mission in addition to the operation against the Islamic State. Military officials likewise viewed Iran’s expansion into Syria as problematic, but they were skeptical about the lack of a clear legal justification that would be required for offensive military action against Iranian-backed forces.

Military officials remain focused on executing an orderly withdrawal of forces from a constellation of small facilities across Syria. While Trump had previously said troops would come home within 30 days, officials said they expect the drawdown to occur within four months, giving the military time to break down its positions and remove sensitive equipment that might have to be destroyed in a more hurried withdrawal.

Although Trump has declared victory against the Islamic State, airstrikes continue against militant forces in eastern Syria, where several hundred extremists were killed in the final weeks of December alone, according to the Pentagon.

“We are continuing the fight against ISIS with our partners in Syria,” a defense official said, using an acronym for the Islamic State.

But officials noted that preparing for a departure will become the troops’ top priority, meaning they will be able to provide less support to the SDF even as it continues to battle the Islamic State.

Officials at the Pentagon and State Department are also intensely skeptical that Turkey will deliver on what the White House has said is a promise to hunt down what remains of the Islamic State. Doing so would require moving Turkish military forces into areas now dominated by the Kurdish SDF, its sworn enemy.

The SDF, meanwhile, might seek to forge an alliance with the Syrian government, potentially strengthening Syrian President Bashar al-Assad. The U.S. departure could also undermine the long-standing goal of forcing a political transition in Syria — let alone seeking to extinguish the Islamic State and reining in Iran at the same time.

“Doing all that with 2,000 U.S. forces was already far-fetched,” another official said. “This is just fantasyland.”