BEIRUT, Lebanon — After the United States toppled Iraq’s dictatorship in 2003, Iran sent arms to militias and backed political parties there, bringing Iraq into its orbit.

After the Arab Spring uprisings early this decade battered the governments of Syria and Yemen, Iran deployed fighters and supported militias. In the chaos of Syria’s long-burning civil war, Iran seized the opportunity to build a military infrastructure there.

In 2015, President Obama offered Iran what might have been the biggest opportunity of all: trading its nuclear program for the lifting of sanctions that had stifled Iran’s economy, paving the way for its reintegration into the international system.

Now President Trump, Israel and the Sunni Arab monarchies of the Persian Gulf want to change all that.

Last week, Mr. Trump withdrew the United States from the international nuclear deal with Iran, reimposing onerous American sanctions and threatening more penalties to punish Iran for its regional behavior. After falling out of favor since the Iraq war, talk of regime change in Tehran has returned to Washington in a way not seen since George W. Bush branded Iran part of the “axis of evil” in 2002.

But as frustrated as Mr. Trump and his allies were that the Iran nuclear agreement did not curb what they regard as regional troublemaking by Iran, it is far from clear that vacating the deal will either.

“If we are going to confront Iran and roll back this Iranian network, what are we going to put on the table?” said Randa Slim, an analyst at the Middle East Institute in Washington. “And if Iran has gained influence and equities from these achievements, how is it going to fight back?”

Iran now maintains a network of powerful militias that defend Iran’s interests far beyond its borders.

Even as Mr. Trump scrapped American participation in the nuclear deal, Iranian-backed political parties were contesting parliamentary elections in Lebanon and Iraq, and Iranian-aligned rebels in Yemen were firing ballistic missiles at the Saudi capital, Riyadh.

The onetime “axis of evil” member has built what it calls an “axis of resistance,” stretching through Iraq and Syria to Lebanon. Iranian forces or allied militias are now basically on the doorsteps of Israel and Saudi Arabia, Iran’s most important regional adversaries.

An alliance against Iran has tightened, with the United States, Israel and the Gulf countries united in opposition. But if they are now more committed than ever to challenging Iran’s reach, their abilities are limited.

The United States is hesitant to get entangled in new wars in the Middle East. Mr. Trump has cut some foreign aid in Syria and said he wants to bring home the roughly 2,000 American troops deployed there fighting the Islamic State.

Gulf countries, led by Saudi Arabia, have spent billions of dollars on advanced weapons over the years but have yet to prove they can use them effectively. They are bogged down in an aerial war against Iranian-aligned rebels in Yemen, and their reliance on checkbook diplomacy has left them with little influence in Lebanon, Syria and Iraq.

By contrast, Iran has devised creative ways to nurture strategic relationships that do not require big military spending, which it cannot afford anyway.

“It is not only the money that greases the network; it is the ideology and the willingness of the Iranians to put their own skin in the game,” said Ms. Slim, the analyst. “The Saudis do not have that kind of toolbox.”

That leaves Israel, which has a powerful military but little ability to build alliances with Arab countries, a legacy of its creation as a Jewish state that is still reviled in the region over the treatment of the Palestinians.

The most recent flare up since Mr. Trump’s abandoning of the nuclear agreement came Thursday, when Iranian forces in Syria fired a barrage of rockets toward Israel for the first time, according to the Israelis, and Israel’s warplanes bombed Iranian military targets in Syria.

Analysts said neither side wanted to escalate into a full-fledged war, which could quickly spiral into a regionwide conflagration, and by dawn, quiet had returned. But the risk of a broader war could not be ruled out.

“We may be O.K. for the next month or so, but we have a big structural problem,” said Cliff Kupchan, chairman of the Eurasia Group, a political risk consultancy in Washington. “Iran wants to build infrastructure in Syria. Israel is dead set against that. So it’s a real witches’ brew. This is a preview of a serious long-term flash point.”

His worry was echoed by Ryan C. Crocker, a former United States ambassador to Syria, Iraq, Lebanon and other countries.

“There is real potential for a much bigger fight than we have seen so far, led by Israel,” Mr. Crocker said. “And will anything good come of it? Not at all.”

Iran would struggle to defend itself against a direct, multifront attack by Israel, the United States and the Gulf countries.

As a Persian, Shiite-led state, it is a sectarian and ethnic minority in a predominantly Sunni, Arab region. Spurned internationally since a revolutionary Islamic government seized power in 1979, it has no access to Western weapons. And Iran’s poor economy means that its regional foes have outspent it on conventional weapons.

Instead, Iran has invested where it could: in relationships with substate actors that mostly share Iran’s Shiite faith and sense of underdog status.

The prototype for that strategy was Hezbollah, which officers from Iran’s Islamic Revolutionary Guards Corps helped create in Lebanon in the early 1980s. Supporting Hezbollah gave Iran a means to fight the Israelis near Israel’s northern border, and later gave Iran a hand in Lebanese politics. Hezbollah, which Israel and the United States have long regarded as a terrorist organization, has since grown into a regional force in its own right.

“Iran is actually not as strong as we think,” said Bassel F. Salloukh, a political-science professor at the Lebanese American University in Beirut. “Its economy is quite weak, it is surrounded, so it has to project power in order to protect itself, and that strategy has worked very well, so they are duplicating it elsewhere.”

Another element of Iran’s power is what enemies call its aspirations and ability to build a nuclear bomb — a weapon Iran always has denied it wants despite past evidence of Iranian research on nuclear bomb-making.

Under the nuclear agreement of 2015, Iran reiterated its pledge to never “seek, develop or acquire any nuclear weapons.” So far, Iran has said it intends to abide by the agreement, despite the American withdrawal.

Iran’s regional military network could not protect it from a conventional attack, but acts as a deterrent by threatening significant costs on Iran’s foes.

Iran can strike Israel directly through Hezbollah, which is believed to have more than 100,000 missiles and rockets, some capable of hitting major Israeli cities and sensitive infrastructure. And Iranian support for the Houthis in Yemen has bogged down Saudi Arabia in a costly war there and made Saudi cities vulnerable to ballistic missiles from Yemen.

Those substate actors are difficult to defeat militarily, and wars against them could exacerbate the failed-state dynamics that Iran has proved adept at exploiting.

Syria remains the most likely flash point, but all of the parties say they do not want a broader war and they appear to be taking steps to prevent clashes from escalating. In its airstrikes in Syria, Israel has made efforts to target weapons and not people, assuming high death tolls could put pressure on Iran and its allies to retaliate.

Iran’s response to Israeli strikes so far has also been limited. The rocket attack on Thursday was aimed at Israeli military installations, not cities.

It remains unclear how Iran will respond to the new effort to roll back its influence. While some within the Iranian hierarchy want to preserve the nuclear agreement even without the United States, some have vowed confrontation.

“Resistance is the only way to confront these enemies, not diplomacy,” Hossein Salami, the deputy head of the Islamic Revolutionary Guards Corps, said last week. “Exiting the deal and their concerns over Iran’s missile work are excuses to bring our nation to its knees.”