The Trump administration has opened a new chapter in American involvement in Syria, vowing to remain until the civil war’s conclusion in a bid to halt Iran’s expansion across the Middle East.

The vision articulated last week by senior U.S. officials marks a dramatic reversal six months after President Trump said he would pull American troops out of Syria and end U.S. involvement in a conflict that has killed at least half a million people and confounded two administrations.

James Jeffrey, the State Department’s special representative for Syria, said the United States would maintain a presence in the country, possibly including an extended military mission, until Iran withdraws the soldiers and militia forces it commands. U.S. officials expect that possible outcome only after world powers broker a deal ending the war.

“The president wants us in Syria until that and the other conditions are met,” Jeffrey told reporters Thursday, saying the U.S. withdrawal was also linked to achieving a lasting defeat of Islamic State militants.

Jeffrey spoke days after national security adviser John Bolton announced that the United States would not withdraw “as long as Iranian troops are outside Iranian borders,” for the first time tying the U.S. trajectory in Syria to challenging Iran.

The new strategy raises the stakes for the Trump administration in Syria, where it must navigate an array of obstacles that also include Russian support for Syrian President Bashar al-Assad, which has reduced his incentive to make concessions required to end the fighting.

Iran is unlikely to easily relinquish its foothold on the Mediterranean after a decades-long investment it dramatically expanded after the war began in 2011.

The Trump administration has made countering Iran’s powerful network of proxy forces, from Lebanon to Iraq to Yemen, a primary goal in the Middle East. In Syria, Iran’s Revolutionary Guard Corps is believed to command at least 10,000 fighters, including Shiite militiamen and government soldiers, forming the backbone of a force that has helped Assad claw back vast areas of the country from rebels.

Faysal Itani, a Middle East scholar at the Atlantic Council think tank, said U.S. officials appear to have renewed hope that the long-stalled U.N. negotiating process can finally produce a settlement. Or, he said, they may be preparing for a lengthy on-the-ground mission, given the remote likelihood of a deal anytime soon.

“So either we are misleading people and want to stay indefinitely, or we are misleading ourselves” in thinking a negotiated conclusion is within reach, Itani said.

The U.N. Security Council has tasked its negotiator with overseeing creation of a new Syrian constitution, an effort the government has so far resisted, in the latest twist in a years-long quest to broker peace.

In keeping with the new strategy, officials have altered their depiction of how long the U.S. military force of about 2,000 troops, stationed in Syria to combat the Islamic State, will remain.

U.S. troops continue to work with a Kurdish-led partner force to hunt down small bands of Islamic State fighters in central Syria, the final redoubt of the militants’ once-vast domain.

Previously, Pentagon leaders had said troops would depart Syria after militant-held territory was reclaimed and stabilized by local forces, suggesting a modest extension of the U.S. troop presence after those areas were cleared. Now, officials appear to be linking the end of the ISIS mission to the goal of establishing security across Syria and a larger denouement to the war.

Speaking to reporters last week, Defense Secretary Jim Mattis said the military would remain until it could ensure that local forces can prevent a militant resurgence like the one that occurred in Iraq after the U.S. withdrawal in 2011.

“That is not an easy thing where you’re up against an enemy as capable as ISIS,” Mattis said. ISIS is another name for the Islamic State. He said the military presence would not be open-ended, because a U.N.-brokered peace deal “is the closing of this whole problem.”

The Pentagon insists that the U.S. military mission in Syria has not changed — by law it is limited to combating the Islamic State. But counterbalancing Iran has become a “secondary benefit” of having American service members there, officials say.

The Trump administration is eager to see Iran’s departure, in part to aid ally Israel, which has conducted a number of strikes this year on Iranian military targets in Syria.

Jeffrey said that the campaign could include a longer-term military mission but that it might entail only a diplomatic presence or support for partner forces.

“This is all about political pressure. It is our expectation that the Syrian government, whatever government is there at the end of this political process, or at some point in the political process, would no longer feel the need to have Iranian forces there,” he said. “We’re not going to force the Iranians out of Syria. We don’t even think the Russians can force the Iranians out.”

Middle East experts said the change in messaging indicates a greater willingness by the Trump administration to leverage the military presence in its larger strategy to isolate Iran. Bolton, a longtime Iran hawk who, like Trump, opposed President Barack Obama’s nuclear deal with Iran, has regularly emphasized the need to prevent Tehran from establishing an “arc of control” from Iran through Iraq, Syria and Lebanon to Israel’s doorstep.

“This is all about constraining Iran’s ability to exert mastery over the region,” said Eric Edelman, counselor at the Center for Strategic and Budgetary Assessments, who served as U.S. ambassador to Turkey and Finland and as a Pentagon official during the George W. Bush administration.

Analysts agree that the continued presence of Iranian forces, Hezbollah and other Shiite militia groups in a predominantly Sunni nation will probably continue to fuel extremism.

Charles Lister, a senior fellow at the Middle East Institute, said al-Qaeda stands to gain from those sectarian tensions, because the Sunni extremist group has presented the Iranians as a core enemy and cast its operations there as a Syrian revolutionary movement against Assad, his Alawite minority and the Shiite militias fighting for him.

Many remain skeptical that the administration’s two-pronged strategy can succeed where others have not.

“The notion that Iran is going to be asked to leave or be forced out in the foreseeable future is illusory,” said Robert Malley, who heads the International Crisis Group and oversaw Middle East policy in the Obama White House. “Iran has been the Assad regime’s longest, most consistent and reliable ally.”

According to one Western diplomat, Iran has spent tens of billions of dollars in Syria and lost thousands of fighters in support of the Assad regime. If the United States keeps a military presence in Syria for as long as the Iranians, that would mean “decades at the very least,” said the diplomat, who spoke on the condition of anonymity to discuss American policy.

Fred Kagan, a scholar at the American Enterprise Institute, said the administration would need to develop a detailed plan for applying pressure beyond the economic sanctions it has used to target Tehran to date.

He said indirect means could get Iran to reduce its military footprint in Syria, but probably not by as much as desired. “If we’re serious about getting to the goals laid out by Bolton and others, we’re going to need to do more.”

Underlying deliberations about the new strategy are questions about the instincts of the president himself, who has expressed opposition to foreign engagements and promised earlier this year that U.S. troops would leave Syria “very soon.”

A longer-term U.S. presence in Syria raises the risk of U.S.-Iranian confrontation. While U.S. and Iranian forces are arrayed mostly in different areas, they have clashed a handful of times when Iranian-backed fighters have veered close to American positions.

Jeffrey and other officials say Trump has voiced a strong commitment to staying in Syria, and the White House may relish an opportunity to show its resolve against Iran, but it’s unknown how the president would respond to an increase in military casualties or a more direct challenge to U.S. personnel or their partners on the ground.

Trump has already authorized two targeted strikes on Syrian military facilities in retaliation for chemical attacks on civilians. But he has not yet been tested by sustained attacks on U.S. forces from Iran-linked militias, similar to the ones that killed at least 500 Americans in Iraq after 2003, or aggressive moves by Iranian proxies against U.S.-backed ­forces.

In that case, “even the Iran hawks will have a big challenge to convince the president to double down,” Lister said. “And I think Iran knows that.”