BEIRUT -- Lebanon's prime minister stepped down from his job Monday in the wake of the catastrophic explosion in Beirut that has triggered public outrage, saying he has come to the conclusion that corruption in the country is "bigger than the state."

The move risks opening the way to dragged-out negotiations over a new Cabinet amid urgent calls for reform. It follows a weekend of anti-government protests after the Aug. 4 explosion in Beirut's port that decimated the facility and caused widespread destruction, killing at least 160 people and injured about 6,000 others.

In a brief televised speech after three of his ministers resigned, Prime Minister Hassan Diab said he is taking "a step back" so he can stand with the people "and fight the battle for change alongside them."

"I declare today the resignation of this government. May God protect Lebanon," he said, repeating the last phrase three times.

The moment typified Lebanon's political dilemma. Since October, there have been mass demonstrations demanding the departure of the entire sectarian-based leadership over entrenched corruption, incompetence and mismanagement.

But the ruling oligarchy has held onto power for so long -- since the end of the civil war in 1990 -- that it is difficult to find a credible political figure untainted by connections to it.

Diab blamed corrupt politicians who preceded him for the "earthquake" that has hit Lebanon.

"They (political class) should have been ashamed of themselves because their corruption is what has led to this disaster that had been hidden for seven years," he added.

"I have discovered that corruption is bigger than the state and that the state is paralyzed by this (ruling) clique and cannot confront if or get rid of it," Diab, who was a professor at the American University of Beirut before he took the job.

Although Diab's resignation had appeared inevitable after the catastrophe, he seemed unwilling to leave and only two days ago made a televised speech in which he offered to stay on for two months to allow for various factions to agree on a road map for reforms. But the pressure from within his own Cabinet proved to be too much.

Diab's government was formed after his predecessor, Saad Hariri, stepped down in October in response to the demonstrations. It took months of bickering among the leadership factions before they settled on Diab.

His government, which was supported by the Hezbollah militant group and its allies and seen as one-sided, was basically doomed from the start, tasked with meeting demands for reform but made up of all the factions that reformers want out. Now the process must start again, with Diab's government in a caretaker role as the same factions debate a new one.

"I hope that the caretaking period will not be long because the country cannot take that. Lets hope a new government will be formed quickly," Public Works Minister Michel Najjar told reporters. "An effective government is the least we need to get out of this crisis."

The weekend protests saw clashes with security forces firing tear gas at protesters.

The explosion is believed to have been caused by a fire that ignited a 2,750-ton stockpile of highly volatile ammonium nitrate. The material had been stored at the port since 2013 with few safeguards despite numerous warnings of the danger.

The result was a disaster Lebanese blame squarely on their leadership's corruption and neglect. Losses from the catastrophic blast are estimated to be between $10 billion to $15 billion, with nearly 300,000 people left homeless.

The last decision taken by Diab's government before its resignation was to refer the case of the explosion to the Supreme Judicial Council, which handles crimes infringing on Lebanon's national security as well as political and state security crimes. The Supreme Judicial Council is Lebanon's top judicial body.

A judge on Monday questioned the heads of the country's security agencies. Public Prosecutor Ghassan El Khoury questioned Maj. Gen. Tony Saliba, the head of State Security, according to state-run National News Agency. It gave no further details, but other generals are scheduled to be questioned.

State Security had compiled a report about the dangers of storing the material at the port and sent a copy to the offices of the president and prime minister on July 20. The investigation is focused on how the ammonium nitrate came to be stored at the port and why nothing was done about it.

Najjar, the public works minister, said he learned about the material's presence 24 hours before the blast, receiving a report about the material and holding a meeting with port officials before calling its chief, Hassan Korayetem.

"I wrote a report in the morning the explosion happened in the evening," Najjar said. Asked why he only learned of it the day before, Najjar said, "I don't know. Truly I don't know."

About 20 people have been detained after the blast, including the head of Lebanon's customs department and his predecessor, as well as the head of the port. Dozens of people have been questioned, including two former Cabinet ministers, according to government officials.

On Sunday, world leaders and international organizations pledged nearly US$300 million in emergency humanitarian aid to Beirut, but warned that no money for rebuilding the capital would be made available until Lebanese authorities commit themselves to the political and economic reforms demanded by the people.

Iran, meanwhile, expressed concern that Western countries and their allies might exploit anger over the explosion to pursue their political interests. Iran supports Hezbollah, which along with its allies dominates the government and parliament.

Iranian Foreign Ministry spokesman Abbas Mousavi said "it is natural for people to be frustrated." But he said it would be "unacceptable if some individuals, groups and foreign countries use the incident as a pretext for their purposes and intentions."

Israeli Defence Minister Benny Gantz drew a line Monday between the blast and claims that Hezbollah stores its rockets and weapons deep inside civilian areas.

While he did not accuse Hezbollah and its arms of being linked to the blast, Gantz said villages and towns across Lebanon were packed with Hezbollah arms that, if set off -- whether by Israeli operations or by accident -- would destroy homes. He said Hezbollah was Lebanon's biggest problem.