The speaker of Israel’s Knesset has resigned after fierce criticism of his refusal to reopen parliament, which he suspended last week citing a ban of large gatherings while the country tackled the coronavirus.

Yuli Edelstein – a close ally of Benjamin Netanyahu in the ruling Likud party – came under fire as the suspension was decried as an attempt to shield both him and the embattled prime minister.

Opposition politicians accused Edelstein of using anti-democratic measures. Benny Gantz, Netanyahu’s chief rival, had planned to gather enough lawmakers to oust Edelstein and elect a new speaker this week.

While Netanyahu still heads an interim administration following an inconclusive 2 March election, Gantz’s Blue and White party, as well as other parliamentarians united against Netanyahu, hold a slim majority of 61 of 120 seats.

Gantz also wanted the Knesset reopened to push through legislation that could end the 70-year-old prime minister’s political career.

Suggested Blue and White bills include limiting the prime ministerial tenure to two terms and ruling that ministers under indictment cannot hold office. Netanyahu would suffer from both laws – he has already served four terms and is facing trial for three separate corruption cases. He denies all accusations.

On Monday, Israel’s supreme court ordered Edelstein to reconvene the Knesset, which he rejected, raising fears of a potential constitutional crisis. Facing growing pressure, the speaker, who was in the job for seven years, made the shock announcement on Wednesday that he would resign instead, accusing the court of “crude and arrogant intervention”.

“As a democrat, as a Zionist Jew, as someone who fought against dark regimes, and as the speaker of parliament, I consider the supreme court decision to be a grave, mistaken decision demonstrating a dangerous moral breakdown,” he said, speaking in the Knesset.

Under parliamentary regulations, Edelstein’s resignation will only take effect in two days, probably postponing political battles into next week.

Although Gantz is officially tasked with forming a government, it is not clear whether he will succeed in building a majority coalition by the mid-April deadline. His bloc is united by being largely anti-Netanyahu but includes Arab politicians who do not support Gantz, a former army chief.

Meanwhile, Netanyahu has attempted to undercut his foe, calling for Gantz to join a unity administration led by him. “Benny Gantz, this is a crucial time for national leadership and responsibility,” Netanyahu tweeted on Tuesday. “Let’s meet now and set up a government.”

In power since 2009, Netanyahu has also been accused of exploiting the pandemic. He has already seen his pending criminal trial postponed, as many court sessions were cancelled, and authorised unprecedented mobile phone surveillance.

Netanyahu argues the emergency measures are vital to prevent the spread of Covid-19 and Israel has enforced other stringent rules.

On Wednesday, the government instructed people to stay within 100 metres of their homes for a week or face a fine or jail, further reduced public transport and required employers to check workers for fevers. Shopping for essentials and food deliveries remained permitted.

More than 2,000 cases of coronavirus infection have been confirmed in Israel, and five deaths reported.

Hundreds of people have gathered outside the Knesset this week to protest against Edelstein and Netanyahu, although being careful to remain two metres apart. One demonstrator, Iris Fain, 58, described the former speaker as “Bibi’s baby”, using a nickname for the prime minister.

Another, Guy Batler, 37, an architect from Tel Aviv, said as along as it remained legal to demonstrate – an activity still permitted under emergency Covid-19 measures – he would.

“We are in a very dangerous situation in which, as part of the battle against the coronavirus, there are certain people who are trying to take advantage, and take powers that are not in their mandate. And here we are trying to make it difficult to do that,” he said.

Additional reporting by Quique Kierszenbaum