Iran’s moves in the region have alarmed the United States. “What’s particularly concerning is that this network of proxies is becoming more and more capable as Iran seeds more and more” of its “destructive weapons into these networks,” Lt. Gen. H.R. McMaster, President Trump’s national security adviser, said at a security conference in Munich on Saturday. “So the time is now, we think, to act against Iran,” General McMaster added.

In expanding its influence in Syria in recent years, Iran has followed a standard template. In Lebanon in the 1980s, it helped create Hezbollah, which has since evolved into the country’s predominant military force and a regional power in its own right, joining the wars in Syria, Iraq and Yemen. In Iraq, Iran has sponsored a range of militias while developing deep ties to the Iraqi economy and political system.

The war in Syria gave Iran a new opportunity to advance that project by linking its allies across the Levant together.

Fighters from Hezbollah routed Syrian rebels near the Lebanese border and Iran sent advisers to help Mr. Assad’s beleaguered forces during the early years of the war.

But by 2013, Mr. Assad’s forces were on the verge of collapse, and Iran intervened more forcefully, undertaking an extensive regional operation to train, arm and transport thousands of Shiite militiamen from abroad to Syria to fight the rebels and the jihadists of the Islamic State.

Estimates of the number of Iranian military personnel in Syria today range from the high hundreds to the low thousands. While some directly participate in combat, most are trainers, commanders or experts who advise the Syrian military and oversee militias. It is these militias, which could have as many as 20,000 fighters, that give Iran its true muscle.

Those fighters include about 6,000 from Hezbollah. Most of the rest of the militia members — who come from Afghanistan, Iraq, Lebanon, Pakistan and elsewhere — have been enticed to fight in Syria with money and appeals to their Shiite faith. Indeed, most see the war in Syria in religious terms, as a jihad against enemies of their religion.