Romanian Prime Minister Victor Ponta announced the resignation of his government Wednesday following huge protests in the wake of a nightclub fire that killed more than 30 people.

"I'm handing in my mandate, I'm resigning, and implicitly my government too," Ponta said in a statement. He said he would stay on until a new government is in place.

"I am obliged to take note of the legitimate grievances which exist in society," said Ponta. "I hope handing in my and my government's mandate will satisfy the demands of protesters."

President Klaus Iohannis will name a prime minister to form a new government, which needs to be approved by Parliament. If this fails twice, early elections will be called. Romania is scheduled to hold parliamentary elections in December 2016.

The mayor of the district in the Romanian capital where the nightclub is located, Cristian Popescu Piedone, also resigned Wednesday, saying he is morally guilty for the deadliest fire in Romania's history.

Piedone said: "I assume the moral blame. As for the legal (blame) I will leave it to justice to pronounce." He came under pressure to step down following mass protests through the city Tuesday night, with more than 20,000 demonstrators blaming widespread corruption for the deadly blaze on Friday night.

Witnesses said the fire broke out during a heavy-metal concert in the basement club when a spark ignited foam decor, sending panicked people stampeding for the single exit. The death toll stands at 32, with some 130 still hospitalized, dozens of them in serious or critical condition.

Deputy leader of the opposition Liberal Party, Catalin Predoiu, hailed the resignations. "This is a victory of the street. It is a lesson for all politicians," he said.

Thousands took to the streets the night before in a spontaneous protest calling for the resignation of Ponta, Interior Minister Gabriel Oprea and Piedone.

They shouted "Shame on you!" and "Assassins!" and waved Romanian flags. Anger has been brewing for some time in Romania against the government, which many perceive as being corrupt, and Friday's fire has added to the discontent.

Even before the fire, Ponta had been under pressure from his oponents to resign, but had refused. He is on trial for corruption charges including tax evasion, money laundering, conflict of interest and making false statements while he was working as a lawyer in 2007 and 2008. At the time, Ponta was a lawmaker. He denies wrongdoing.

Romanians had also called for the resignation of Oprea over the on-duty death of a police motorcyclist, who died after he hit a hole on Oct. 20. He was in a motorcade easing a route in Bucharest for Oprea.