Lebanese Prime Minister Saad Hariri. (Ludovic Marin/AFP/Getty Images)

Lebanese Prime Minister Saad Hariri resigned Saturday in a surprise move that upended his alliance with the powerful Hezbollah movement and raised the risk of conflict in Lebanon.

Hariri announced his resignation in Saudi Arabia and cited the influence of Iran over the Lebanese government as the reason for his decision to step down, putting Lebanon squarely on the front line of an accelerating power struggle between Tehran and Riyadh.

Through Hezbollah, Iran has created "a state within a state" in Lebanon, Hariri said in a televised address from Riyadh. He accused Iran of sowing "sedition, devastation and destruction in any place it settles in."

"I want to tell Iran and its followers that they are losing in their interferences in the affairs of Arab nations. Our nation will rise just as it did before, and the hands that will harm it will be cut," Hariri said, suggesting that his move represented the beginning of a broader effort backed by Saudi Arabia to confront Iran in Lebanon.

The resignation signaled an end to the shaky alliance that had underpinned Lebanon's government between Hariri, a Sunni Muslim who is a longtime ally of Saudi Arabia, and the Shiite Hezbollah movement, which is backed by Iran. The arrangement helped Lebanon keep a distance from the violence convulsing neighboring Syria and the wider region but stirred deepening concerns among Iran's foes about growing Iranian influence in the country.

Israel, which has threatened in recent months to go to war against Hezbollah in Lebanon, welcomed Hariri's decision as "a wake-up call to the international community to take action against Iranian aggression," according to a statement issued by the office of Prime Minister Benjamin Netanyahu.

In another sign of the deepening regional tensions, Iranian-backed Houthi militias in Yemen fired a missile toward Riyadh shortly after the announcement in a rare attack on the Saudi capital. The Saudi authorities announced that the missile had been intercepted, but parts of it landed in the vicinity of King Khalid International Airport.

The United States, which has been pushing a more assertive stance toward Iran in the region, did not immediately comment, and it was unclear whether the Trump administration was involved in what appeared to be a Saudi initiative to confront Iran in Lebanon.

An adviser to Iran's Foreign Ministry, in comments quoted by the Iranian news agency Fars, directly accused President Trump of coordinating the Hariri resignation with Saudi Arabia. "The resignation was planned by the Americans to make up for their losses after ISIL was defeated in the region," said Hossein Sheikholeslam, using an acronym for the Islamic State.

Iranian Foreign Ministry spokesman Bahram Ghasemi called it a source of "pity and wonder" that Hariri announced his resignation in a foreign country, and he disputed Hariri's allegations against Iran. Hariri's "unreal and baseless accusations . . . show that the resignation is designed to create tensions in Lebanon and the region," he said.

The announcement appeared to take most of Lebanon by surprise, including Hezbollah, according to an official familiar with Hezbollah leaders' thinking. It also stirred widespread concerns about the dangers of conflict in Lebanon, which had become a surprise beacon of relative stability in the region throughout the turmoil of recent years.

Hariri hinted that he believed his life was in danger, describing the atmosphere in Lebanon as similar to the national mood when his father, Prime Minister Rafiq al-Hariri, was assassinated in 2005 after resigning from office. "I sensed what is being woven in secret to target my life," Hariri said.

Saudi Arabia's gulf affairs minister, Thamer al-Sabhan, later said in a television interview that Hariri's bodyguards had received "confirmed information" of a plot to kill him but that the allegation could not be independently confirmed.

The assassination of Hariri's father, blamed by a United Nations inquiry on Hezbollah operatives, was followed by years of tensions in Lebanon between Hezbollah and U.S.-backed allies in the Sunni and Christian communities. A string of bombings killed more than a dozen Hariri allies and Christian politicians, and there were periodic firefights between rival militias. The tensions culminated in Hezbollah's armed takeover of the streets of West Beirut in 2008, which secured Hezbollah's political sway over the Lebanese state.

In a brief statement, Lebanese President Michel Aoun, a Hezbollah ally, said Hariri notified him of the decision, which would be discussed further when the former prime minister returns to Lebanon.

Aoun, a close ally of Hezbollah, was elected president in October 2016 after more than two years in Lebanon without a head of state. He appointed Hariri in late 2016 to a 30-member national unity cabinet that includes Hezbollah.

It is not clear who will succeed Hariri, but under Lebanon's constitution, the prime minister must be a Sunni Muslim.

Hariri previously served as prime minister starting in November 2009, but he lost the title in early 2011 when the Hezbollah members of his cabinet resigned.

Since the outbreak of the Syrian war in 2011, Hezbollah has emerged as one of the most powerful military and political forces in Iran's arsenal as it seeks to increase its influence across the region. Designated a terrorist organization by the United States, Hezbollah has sent thousands of its members to Syria to fight on behalf of Syrian President Bashar al-Assad, and it has contributed a smaller number of fighters to battle alongside allies in Iraq and Yemen.

Loveluck reported from London and Sly from Washington.