By Samia Nakhoul

BEIRUT (Reuters) - The U.S. killing of Qassem Soleimani, Iran's most powerful figure after its supreme leader, is seen by Tehran as an act of war that risks regional conflagration.

By ordering Friday's air strike on the commander of the Iranian Revolutionary Guard's foreign legions, President Donald Trump has taken the United States and its allies into uncharted territory in its confrontation with Iran and its proxy militias across the region.

The Iranian leadership may bide its time.

But most analysts believe this blow to its prestige, plus Supreme Leader Ayatollah Ali Khamanei's personal commitment to Soleimani and his campaign to forge an axis of Shi'ite paramilitary power across the Levant and into the Gulf, means Iranian reprisals will be lethal.

It risks a slide into direct conflict with the United States that could engulf the whole region.

"The direct assassination of Soleimani by the United States is a naked challenge and Iran has to carry out a major face-saving act to respond," said Mohanad Hage Ali, a fellow at the Carnegie Middle East Center in Beirut. "This is not the end of it."

Soleimani, who made his name in Iran's war with Iraq in the 1980s, rose in 1998 to command the Quds Force, the overseas arm of Iran's Revolutionary Guard Corps (IRGC).

After the U.S.-led invasion of Iraq in 2003 toppled Saddam Hussein's Sunni rule and brought Iraq's Shi'ite majority to power, the Quds Force built up a powerful array of proxy militias to harry the U.S. occupation.

They were modeled on Hezbollah, the Shi'ite paramilitary force Iran created in Lebanon – but in Iraq they were four times bigger.

When Syria was plunged into war by the Sunni rebellion that started in 2011, Soleimani mobilized Hezbollah and Iraqi Shi'ite militias to save President Bashar al-Assad and establish a new Quds fortress.

That enabled Iran to link up its paramilitary proxies in a Shi'ite axis of power across Iraq and through Syria to the Mediterranean, alarming U.S. allies such as Israel, Saudi Arabia and Egypt.

NETHER FORGOTTEN NOR FORGIVEN

Soleimani, the architect of this muscular policy, then became a regional legend and popular icon in Iran after his forces spearheaded the fight against Islamic State in Syria and Iraq.

But the seemingly inexorable success of Soleimani's paramilitary strategy – permanently mobilized militias armed with precision missiles and drones – came at a cost.

In Iraq, the Popular Mobilization Forces, the 100,000-strong paramilitary alliance at the sharp end of the power struggle between Iran and the United States, may have over-reached.

At the instigation of Soleimani and the Quds Force, PMF units have stepped up harassment of U.S. troops in Iraq.

But the killing of an American contractor at a base in northern Iraq attacked by the Kataib Hezbollah militia last week prompted U.S. air strikes that killed 25 pro-Iranian fighters.

In response, the militias laid siege to the U.S. embassy in Baghdad, breaking through the perimeter before withdrawing.

That reminder of the occupation of the U.S. embassy in Tehran in 1979 – a humiliation Americans have never forgiven – may have prompted Trump, facing re-election as well as impeachment this year, to sign Soleimani's death warrant.

"The Americans have never forgotten the storming of their embassy in Tehran and the hostage-taking," says Sarkis Naoum, a leading regional analyst.

"This issue for them was bigger than Soleimani's killing," he added. "Their embassy was the symbol of the nation and their influence."

MULTI-PRONGED RESPONSE?

From Iran's point of view, protests against corruption and bad governance in Iraq and Lebanon are a reminder of the start of the Syrian conflict in which Soleimani's forces intervened to save Assad.

Soleimani traveled to both countries in recent weeks to ensure his Hezbollah and PMF allies held the line to protect Iran’s political and military influence.

After the elimination of Soleimani, Iran is expected to double down in Iraq, Lebanon, Syria and Yemen on what it regards as its forward lines of defense against a U.S.-led attempt to encircle it with the help of Israel and Saudi Arabia.

Iran has already given examples of how it can respond.

After the Trump administration withdrew from the nuclear deal Iran signed with the United States and other world powers in 2015, the IRGC and its proxies progressed from limited attacks on oil tankers in the Gulf to spectacular missile and drone assaults on Saudi oil installations.

Analysts now see a multi-pronged Iranian response against the United States and its allies as certain.

Already the Soleimani killing has united otherwise fractious Iraqi Shi'ite groups in demanding U.S. forces quit Iraq.

A senior official in the Iranian-led regional military alliance said: "When the Americans take this deliberate decision to kill Soleimani it means they have taken a decision for war."

"There will not be a quick revenge," said Carnegie's Hage Ali. "Even in a situation like this they are cold, they consider their options and then they react. It will take time but all options are on the table."

The Soleimani operation "is a strike into the heart of Iran: they have not just killed Iran's military mastermind in the region but taken out a future leader of Iran", Naoum said.

(Additional reporting by Laila Bassam,; Writing by Samia Nakhoul; Editing by Giles Elgood)