President Trump, who just five months ago said he wanted “to get out” of Syria and bring U.S. troops home soon, has agreed to a new strategy that indefinitely extends the military effort there and launches a major diplomatic push to achieve American objectives, according to senior State Department officials.

Although the military campaign against the Islamic State has been nearly completed, the administration has redefined its goals to include the exit of all Iranian military and proxy forces from Syria, and establishment of a stable, nonthreatening government acceptable to all Syrians and the international community.

Much of the motivation for the change, officials said, stems from growing doubts about whether Russia, which Trump has said could be a partner, is able and willing to help eject Iran. Russia and Iran have together been Syrian President Bashar al-Assad’s principal allies in obliterating a years-long effort by domestic rebels to oust the Syrian leader.

“The new policy is we’re no longer pulling out by the end of the year,” said James Jeffrey, a retired senior Foreign Service officer who last month was named Secretary of State Mike Pompeo’s “representative for Syria engagement.” About 2,200 U.S. troops are serving in Syria, virtually all of them devoted to the war against the Islamic State in the eastern third of the country.

Jeffrey said U.S. forces are to remain in the country to ensure an Iranian departure and the “enduring defeat” of the Islamic State.

“That means we are not in a hurry,” he said. Asked whether Trump had signed off on what he called “a more active approach,” Jeffrey said, “I am confident the president is on board with this.”

Jeffrey declined to describe any new military mission. But he emphasized what he said would be a “major diplomatic initiative” in the United Nations and elsewhere, and the use of economic tools, presumably including more sanctions on Iran and Russia and the stated U.S. refusal to fund reconstruction in Assad-controlled Syria.

But the more-activist policies he outlined, and only in vague terms, could increase the likelihood of a direct confrontation with Iran, and potentially with Russia.

Jeffrey’s description of a much broader U.S. role follows years of criticism from lawmakers and analysts that neither Trump nor his predecessor, Barack Obama, had a coherent strategy for Syria. Trump, like Obama, insisted that U.S. interests were focused on defeating the Islamic State, and he resisted significant involvement in the civil war against Assad raging in the rest of the country, even as both Iran and Russia increased their influence.

Jeffrey and retired U.S. Army Col. Joel Rayburn, who transferred to the State Department from the National Security Council last month to become “special envoy for Syria,” were brought in to try to create a coherent blueprint that would prevent a repeat of what the administration sees as the mistakes of Iraq — where a precipitous U.S. pullout left the field open for Iran, and for a resurgence of Sunni militants that gave birth to the Islamic State.

Pompeo first listed Iran’s withdrawal from Syria as one of 12 U.S. demands of Tehran in a May speech at the Heritage Foundation.

U.S. policy is not that “Assad must go,” Jeffrey said. “Assad has no future, but it’s not our job to get rid of him.” He said, however, that he found it hard to think of Assad as a leader who could “meet the requirements of not just us but the international community” as someone who “doesn’t threaten his neighbors” or abuse his own citizens, “doesn’t allow chemical weapons or provide a platform for Iran.”

The first test of the administration’s expanded role in Syria may come sooner rather than later in Idlib, in the northwest part of the country.

The province is the last bastion of rebel control after seven years of civil war, during which Assad, with extensive Russian and Iranian assistance, pounded opposition forces into submission. His scorched-earth tactics and, at times, use of chemical weapons have killed hundreds of thousands of civilians and driven millions from their homes.

Idlib has now become a crowded holding pen for up to 70,000 opposition fighters, along with about 2 million Syrian civilians displaced from other battle zones, and activists and aid workers trying to assist them.

Turkish military forces are also in Idlib, where they have pushed back Syrian Kurds from the Syria-Turkey border. Turkish President Recep Tayyip Erdogan, who fears a new exodus of Syrian refugees, is due to attend a summit in Tehran on Friday with Russian President Vladi­mir Putin and Iranian President Hassan Rouhani.

Assad has said he is preparing a final offensive in Idlib, and Russian warplanes this week began bombing the region. Humanitarian organizations have warned of an unprecedented level of civilian bloodshed, and Trump himself has threatened U.S. retaliation if an all-out offensive is launched, especially with the use of chemical weapons.

“If it’s a slaughter, the world is going to get very, very angry. And the United States is going to get very angry, too,” Trump said Wednesday. Pompeo, Jeffrey said, has delivered the same message by telephone to Russian Foreign Minister Sergei Lavrov, as did White House national security adviser John Bolton in a recent meeting with his Russian counterpart.

Russia, which has beefed up its naval and other forces in the region in recent weeks, has charged that the United States is preparing to manufacture a chemical weapons attack to justify military intervention. It says its operations in Idlib are aimed at up to 14,000 fighters linked to al-Qaeda.

While the United States agrees that those forces must be wiped out, it rejects “the idea that we have to go in there . . . to clean out the terrorists, most of the people fighting . . . they’re not terrorists, but people fighting a civil war against a brutal dictator,” as well as millions of civilians, Jeffrey said. Instead, the United States has called for a cooperative approach with other outside actors.

“We’ve started using new language,” Jeffrey said, referring to previous warnings against the use of chemical weapons. Now, he said, the United States will not tolerate “an attack. Period.”

“Any offensive is to us objectionable as a reckless escalation” he said. “You add to that, if you use chemical weapons, or create refu­gee flows or attack innocent civilians,” and “the consequences of that are that we will shift our positions and use all of our tools to make it clear that we’ll have to find ways to achieve our goals that are less reliant on the goodwill of the Russians.”

Trump has twice authorized U.S. air and missile attacks on Syrian government targets as punishment for chemical weapons use.

Asked whether the United States would consider its own airstrikes against terrorist forces who are interspersed with Syrian rebel fighters in Idlib, Jeffrey said, “We have asked repeatedly for permission to operate” there, and “that would be one way” to respond.

“In some respects, we are potentially entering a new phase, where you have forces from the different countries facing each other,” rather than pursuing their separate goals, he said, listing Russia, the United States, Iran, Turkey and Israel, which has conducted its own airstrikes against Iran-linked forces inside Syria.

“Now all of them have accomplished their primary jobs” there. “But nobody is happy with the situation in Syria.”

Clarification: An earlier version of this article mischaracterized State Department official James Jeffrey’s comment regarding possible U.S. airstrikes in Syria as a response to a Syrian-Russian offensive in Idlib. The remark — “We have asked repeatedly for permission to operate”— referred to potential ways of attacking terrorist forces there interspersed with Syrian rebel fighters.