Poland's ruling Law and Justice (PiS) party on Monday rammed through dramatic changes to the country's electoral system —which the opposition denounced as a "coup" — just weeks ahead of the May 10 presidential election.

In a chaotic day in the country's Sejm, the lower chamber of parliament, PiS first narrowly lost a vote on holding the election by a postal ballot because of the pandemic, then held another vote on an amended measure on Monday evening, which it won.

The result would allow PiS to organize the presidential election via post, with no physical polling stations. The bill would allow the speaker of parliament, a PiS MP, to postpone the vote to no later than May 17 if the country is in a state of epidemic — something that has already been declared.

The voting would be an unprecedented logistical feat for a country that has never before held such an election. The Polish post office would have to deliver all the ballots (halting all other mail deliveries) to voters based on previous addresses; destroying a ballot is punishable by three years in prison. Voters would then have to drop off the ballots at specially prepared boxes.

"The law is neither easy, nor cheerful, nor popular," admitted Łukasz Schreiber, a PiS MP, during the raucous parliamentary debate.

PiS and its leader Jarosław Kaczyński, Poland's de facto ruler, are determined that the presidential election must go ahead as planned.

The new legislation raises legal and constitutional questions, and Poland's top court has ruled that electoral laws can't be changed six months before a ballot.

"I personally think that the idea of postal voting is interesting," President Andrzej Duda, whose reelection is backed by PiS, said Monday. "We need these elections."

The opposition is accusing the ruling party of foul play.

"PiS is organizing a coup d'état to ensure itself total power for years to come," tweeted Małgorzata Kidawa-Błońska, the presidential candidate of the opposition Civic Coalition.

Delay could be costly for PiS

PiS and its leader Jarosław Kaczyński, Poland's de facto ruler, are determined that the presidential election must go ahead as planned. Duda is far ahead in opinion polls. The latest survey has him at 47 percent, while Kidawa-Błońska trails at 12.4 percent.

The opposition complains the lockdown has made campaigning impossible, while Duda is constantly on the news of the state media — effectively a propaganda arm of the ruling party.

However, only 30 percent of those surveyed said they would show up to vote — underlining the worry many Poles feel about such public events during the pandemic and a national lockdown. Poland is still less affected than many other EU countries — as of Monday evening it had 4,413 coronavirus cases and 107 deaths — but the numbers are rising and the peak of the pandemic is expected weeks from now.

Delaying the vote is a potential crisis for PiS. The country's health service is underfunded and there are growing complaints from business about the scale of the government's economic rescue effort. If the situation deteriorates significantly, Duda could have trouble winning a second five-year term.

An opposition president would be a fatal blow for Kaczyński's effort to remake Polish society — something that has embroiled Poland in bitter fights with EU institutions worried that the country is backsliding on the bloc's democratic rules.

That's why the government has been unwilling to declare a state of emergency to deal with the pandemic, as such a measure would delay any election until 90 days after such an emergency is lifted — pushing a vote into the fall.

The upper chamber can delay action for 30 days before legislation goes back to the more powerful Sejm, which can again pass the measure.

The effort is straining PiS. On Monday the leader of a small conservative party that forms an alliance with Law and Justice quit the government, however, that didn't threaten the PiS's control of the Sejm.

The bill isn't yet law.

It now goes to the upper house or Senate — narrowly controlled by the opposition. Senate Speaker Tomasz Grodzki has already said he’s going to “take all the possibilities to consult constitutional lawyers on this issue.” The upper chamber can delay action for 30 days before legislation goes back to the more powerful Sejm, which can again pass the measure.

If the Senate holds the bill for as long as it can, it would leave very little time to organize a postal ballot.