In a televised address from Riyadh,
Hariri said he feared an assassination plot and accused Iran of meddling in the region, causing "devastation and chaos."
"Iran controls the region and the decision-making in both Syria and Iraq," he said. "I want to tell Iran and its followers that it will lose in its interventions in the internal affairs of Arab countries."
Iran dismissed the reports, accusing the United States and Saudi Arabia of orchestrating the resignation.
"Hariri's resignation was coordinated with US President Donald Trump and Saudi Arabia's Mohammad bin Salman
," Iranian Foreign Ministry official Hossein Sheikholeslam told the semiofficial Fars News Agency.
"The resignation was aimed at creating tension in Lebanon and the region. This resignation was also meant to compensate the US for its failures after the defeat of the Daesh (ISIS)."
In his speech, Hariri, a Sunni politician, also pointed to Hezbollah, the powerful Iranian-backed Shiite militant group in Lebanon.
"Over the past decades, Hezbollah has unfortunately managed to impose a fait accompli in Lebanon by the force of its weapons, which it alleges is a resistance weapon," Hariri said.
"Lebanon and the great Lebanese people became in the eye of the storm and subjected to international condemnations and economic sanctions because of Iran and its arm Hezbollah."
Hezbollah Secretary-general Hassan Nasrallah
hit back Sunday in a televised speech, pointing to Saudi Arabia.
"The resignation was a Saudi decision," Nasrallah said in his speech, carried by Hezbollah-owned Al-Manar TV. "Prime Minister Saad Hariri was told and forced to do so."
The Hezbollah head also accused Saudi Arabia of writing Hariri's statement.
"We will not comment or discuss the political content of the (Hariri) statement, although the content was cruel and contains big and dangerous accusations, myself and Hezbollah will not discuss the content because we believe it was written by Saudi," Nasrallah said.
While the United States considers Hezbollah a terrorist group, its political wing is the most powerful bloc in Lebanon's deeply divided coalition government, and several of its politicians are ministers.
Lebanese President Michel Aoun, a Christian who's affiliated with Hezbollah, confirmed he had received a phone call from Hariri about stepping down.
Aoun's office said he would wait for the Prime Minister to return to Beirut to discuss the circumstances of his resignation.
Climate of fear
In his speech in the Saudi capital, Hariri said the atmosphere in Lebanon was similar to the one that existed 12 years ago right before the assassination of his father, former Prime Minister Rafik Hariri
"We live in an atmosphere similar to the atmosphere that prevailed before the assassination of martyr Prime Minister Rafik Hariri, and I sensed what is being woven in secret to target my life," he said.
Hariri's father was assassinated in February 2005 when a bomb struck his motorcade near the Beirut seafront.
A special UN-backed court is trying alleged associates of Hezbollah in absentia in his killing. Hezbollah denies involvement.
The assassination was a pivotal event in Lebanon, further fueling the sectarian divisions between Sunni and Shiite Muslims. The Mediterranean country has a large Christian population as well.
The death also led to the withdrawal of Syrian troops, deployed in Lebanon
between 1976 and 2005. They first came as peacekeepers to help stop Lebanon's civil war but remained long after the fighting stopped in 1990. Syria has dominated Lebanon's political scene for much of its post-independence history.
Analyst: Saudi Arabia is 'primary driver'
The longstanding animosity between two regional powerhouses -- Sunni Saudi Arabia and Shiite Iran -- was a major factor in Saturday's developments, said Randa Slim, director of a conflict resolution program at the Middle East Institute in Washington.
"I think the primary driver for this resignation is Saudi Arabia," Slim told CNN. "It indicates the Saudi decision to confront Iran and the Iranian influence in Lebanon by going after Hezbollah."
The fact that Hariri's announcement was made in Riyadh was an important clue, she said. She also noted Hariri holds dual citizenship in Lebanon and Saudi Arabia.
"By going after Hezbollah, by denying Hezbollah a credible Sunni partner in governance, it thus weakens Hezbollah on the home front," Slim said.
Meanwhile the fallout has begun. Bahrain's government on Sunday called on its citizens to leave Lebanon immediately in the wake of Hariri's resignation.
"The Ministry of Foreign Affairs also renews its call to all citizens not to travel to the Republic of Lebanon, for their safety, and to avoid any risks they may be exposed (to) as a result of these developments," said a statement released by Bahrain's Foreign Ministry.
Hariri's second stint as Prime Minister
Lebanese President Aoun asked Hariri to become Prime Minister last year. He headed a national unity Cabinet that included Hezbollah.
It marked Hariri's second stint as Prime Minister. Hariri first took office in June 2009. Less than two years later, 11 Hezbollah members of his Cabinet resigned, causing a coalition government to collapse.
Under the Lebanese Constitution
, the president must be a Maronite Christian, the prime minister a Sunni and the speaker of the Parliament a Shiite Muslim.
Earlier this year, Hariri met President Donald Trump at the White House. They spoke about economic issues and the pressure on Lebanon after an influx of 1.5 million displaced Syrians in the country.
Trump also warned about the danger of Hezbollah.
"Threats to the Lebanese people come from inside
as well. Hezbollah is a menace to the Lebanese state, the Lebanese people and the entire region," he said. "The group continues to increase its military arsenal, which threatens to start yet another conflict with Israel, constantly fighting them back."