BEIRUT (AP) — Lebanese Prime Minister Saad Hariri's bombshell resignation in a televised speech from Saudi Arabia took the nation by surprise Saturday.

In his announcement, Hariri accused Iran and its Lebanese ally, Hezbollah, of holding Lebanon hostage and destabilizing the Arab region.

But what is behind his resignation and what does it mean for Lebanon?

THE BACKGROUND

Hariri became prime minister in late 2016 in a coalition government that included the Shiite militant group Hezbollah.

It has been an uneasy partnership between Hariri, a Sunni Muslim aligned with Saudi Arabia, and Hezbollah, Iran's Shiite proxy in Lebanon, which has sent thousands of its fighters to shore up President Bashar Assad's forces in Syria's civil war.

As Hezbollah and Iranian-backed Syrian troops made successive military victories, Hariri came under pressure from Washington and Riyadh to distance himself from the group.

In recent days, Lebanese government ministers have bickered publicly over sending an ambassador to Damascus and repatriation plans for hundreds of thousands of Syrian refugees living in Lebanon. Officials denied the tension threatened the unity government.

Then suddenly, Hariri flew to Saudi Arabia earlier this week in a previously unannounced trip. He flew again to Riyadh Friday.

It is not clear what exactly prompted his shock resignation — unprecedented in the way it was announced in a televised address from an undisclosed location in Riyadh. Even close aides seemed not to know it was coming.

In his speech, Hariri said he feared for his life, suggesting he may not be coming home soon. Hariri was prime minister from 2009 until 2011, when Hezbollah ousted him from office. He had until last year lived in self-imposed exile in Saudi Arabia and France.

SAUDI IRAN RIVALRY

Hariri's resignation is a reflection of the growing power struggle between Iran and Saudi Arabia in the region. The Iran-Saudi rivalry is rooted in both countries' claim to represent different strands of Islam, Shiite and Sunni, a more than thousand-year-old dispute. Iran's Islamic revolution in 1979 unsettled the ultraconservative Sunni Kingdom. But the explosive modern race grew with Iran's rising influence in Syria, Iraq and Yemen, where Tehran is supporting various players.

Hezbollah, one of Tehran's most reliable partners, has been a key player in the wars in Syria and Yemen, undermining Saudi clout in Syria, and reaching the kingdom's borders by supporting Yemen's anti-Saudi rebels.

With the ascension of the ambitious firebrand Mohammed Bin Salman to crown prince in Saudi Arabia, the rivalry with Tehran took a sharper turn. In one interview, he threatened to take the war to Iran.

WHAT HAPPENS NOW

Hariri's resignation has to be accepted by President Michel Aoun, a formality. It effectively shatters the national unity government and plunges the country into uncertainty and potentially a prolonged period of political paralysis.

Aoun must appoint a new prime minister, but it will be difficult to find a consensual Sunni figure able to form another coalition government. According to Lebanon's sectarian-based power-sharing system, the president must be a Maronite Christian, the prime minister a Muslim Sunni and the parliament speaker a Shiite Muslim.

A new government that leans further toward Hezbollah would risk isolating the country and subjecting it to U.S. sanctions.

POTENTIAL INSTABILITY

Already, Lebanon's Hezbollah has been targeted by U.S. sanctions aimed to block the flow of money to the group, a move that threatened to cause major damage to the country's solid banking sector if passed into law. Washington considers Hezbollah to be a terrorist organization and U.S. lawmakers called it Iran's leading "terrorist proxy."

With Israel, Saudi Arabia and the U.S. seeing eye to eye on the need to stem Iran's growing clout, many fear Lebanon may be the place for a showdown with Iran's ally, Hezbollah.

Israel and Hezbollah have fought a number of wars, the last of which ended in a stalemate in 2006. Israel has recently said it will not tolerate an Iranian presence in Syria, spearheaded by Hezbollah, which has also established a presence near the Syria-Israel border.

___

Associated Press writer Zeina Karam in Beirut contributed to this report.