JERUSALEM — Prime Minister Benjamin Netanyahu announced Wednesday that he would ask the Israeli parliament to grant him immunity in three criminal cases, tying up further the already lengthy legal proceedings against him in a political system that has been gripped by deadlock for the past year.

Netanyahu’s immunity request to the Knesset would shield him from prosecution at least while he remains in office. It also pitches the country’s political establishment against the legal system ahead of an unprecedented third general election in less than a year. That election is set for March 2.

Twice in 2019 Netanyahu failed to form a government following earlier rounds of voting in April and September. Part of the stalemate is the reluctance of his political rival, Benny Gantz — former military chief of staff and head of the centrist Blue and White faction — to join a coalition with a leader charged with crimes.

In November, Attorney General Avichai Mandelblit concluded that there was enough evidence to prosecute Netanyahu in three cases involving allegations that he and his wife, Sara, accepted more than $260,000 worth of luxury goods in exchange for political favors and that he interceded with regulators and lawmakers on behalf of two media companies in exchange for positive news coverage.

Netanyahu has criticized the prosecution as a politically motivated “coup” to oust him from office. But the allegations have cast a shadow over his legacy and forced him to justify why and how he can continue to run for office.

In a statement broadcast live Wednesday on Israeli television, Netanyahu said that he was not trying to escape prosecution and that the immunity provision would only last for the duration of the next parliament’s term.

In the address, Netanyahu said that the criminal cases were an attempt to frame him and that it was up to the public and not the courts to decide whether he should continue leading the country.

“The immunity law is meant to protect public representatives from being framed,” he said. “The law is meant to ensure that public representatives can serve the people according to the will of the people, and not the will of some clerks.”

Israel’s law on immunity is designed to allow officials to pursue matters of public interest without fear of prosecution — as long as they are within the confines of the law. Immunity can also be invoked if it is believed the indictment was issued in bad faith or if the alleged wrongdoing was committed in the Knesset building and was dealt with by that body. It can also be bestowed if the prosecution would cause serious damage to the functioning of the parliament.

In a letter to parliament speaker Yuli Edelstein, Netanyahu said his immunity request was based on the fact that the cases discriminated against him, were filed in bad faith and that if a criminal proceeding were to take place at this time it would cause damage to the functioning of the Knesset and to elected public officials.

Yuval Shany, vice president of the Israel Democracy Institute, said Netanyahu will have a tough time prevailing on his immunity request. Even if approved by the Knesset — first by a house panel and then by a vote of the entire parliament — the Supreme Court most likely wouldn’t allow it to stand.

“Netanyahu is in a difficult situation — he needs to explain why he is running for office with three indictments against him, and that is why he is spinning the story that he is being sidelined by the elite, the legal system and the media because he is so successful and because of his positions,” he said. “He is telling the public ‘you have to vote for me, it is you who has to decide, not them.’ ”

Further complicating the process is the hypothetical question of whether a prime ministerial candidate who is facing criminal prosecution is legally permitted to form a government.

On Tuesday, the High Court heard a legal petition on the matter and decided it would not form an opinion, passing the question to Israel’s president, who following an election must task one candidate with forming a government.

After a landslide win last week in primaries for leadership of the ruling Likud party, Netanyahu appears more confident than ever that he will also be victorious in the March general election. In a video clip to his supporters this week, he said that “in a democracy, it is only the people who decide who will lead the people, not anyone else — that is how it always has been and that is how it always will be.”

On Sunday, he declared in a speech that immunity was the “cornerstone of democracy.”

Speaking immediately after Netanyahu on Wednesday, Gantz said that seeking immunity, in this case, was not “a cornerstone of democracy” but rather another form of corruption. “The legislature should not be a haven for criminals,” he said. He vowed that should his party win the March vote, it would amend the immunity law “to ensure that it cannot be used to evade criminal offenses.”

“Netanyahu is trying to deflect the conversation from the question of his criminal offenses to a debate about democracy,” said Dan Avnon, professor and political science department chairman at the Hebrew University of Jerusalem. “It is a detailed strategy of undermining a liberal democracy to an Israeli version of a majoritarian democracy.”

Netanyahu believes that if he is successful in the March vote, he will be able to argue in favor of the “rule of the people over the judicial elite,” Avnon said.