JERUSALEM — Prime Minister Benjamin Netanyahu, hours before facing a likely defeat in the Israeli parliament, withdrew his request Tuesday for official immunity from prosecution on corruption charges, giving up a controversial gambit to shield himself from legal peril a month before a national election.

Within hours, Israel's attorney general filed criminal indictments against Netanyahu in Jerusalem's District Court, kicking off legal proceedings that will unfold over coming months.

Netanyahu, who was in Washington for the debut of President Trump’s long-awaited Israeli-
Palestinian peace plan, angrily denounced his opponents for pushing a key vote on his immunity bid while he was on a diplomatic mission.

“Instead of grasping the gravity of the hour and rising above political considerations, they continue to engage in cheap politicking, harming a decisive moment in the history of the country,” Netanyahu wrote on Facebook. “I won’t let political maneuvers interfere with this historic moment.”

Less than a month ago, Netanyahu himself asked the Knesset to take up the issue, requesting a grant of formal protection from multiple counts of bribery, fraud and breach of trust. The first sitting Israeli prime minister to be indicted in office, Netanyahu previously condemned the years-long investigation against him as a politically motivated “witch hunt.”

But it soon became clear his Knesset critics had the votes to deny his petition. Led by the largest party, Blue and White, they relentlessly pushed to advance the process in the face of increasing resistance from Netanyahu’s ­Likud Party.

“Netanyahu has asked for an immunity vote; he will get an immunity vote,” said Blue and White leader Benny Gantz, Netanyahu’s chief rival over the course of two inconclusive national elections since April and his neck-and-neck opponent in a third vote scheduled for March 2.

The standoff was slated to come to a head Tuesday, with the Knesset widely expected to vote on forming the immunity committee even as Netanyahu’s supporters vowed to boycott the session. That schedule was suddenly called into question last week with the surprise invitation to both Netanyahu and Gantz to come to Washington for a peace plan summit on that very day.

Critics cried foul, accusing the prime minister of using his White House ties to create a distraction from the immunity vote and pulling his rival out of play at a critical moment. But Gantz, a political newcomer, surprised observers by wrangling a change in plans, obtaining his own meeting with Trump a day early and boarding a plane back to Israel in time for the Knesset session.

Gantz was in the air returning for the Knesset hearing when ­Netanyahu withdrew his request in a Facebook post, claimed parliamentary rules were ignored and dismissed the procedure he had set in motion as an “immunity circus.”

Gantz, a former army chief of staff, has largely based his campaign on Netanyahu’s inability to lead the country while under a legal cloud and, now, the formal indictments of Netanyahu.

“Netanyahu is going to trial; it must move forward,” Gantz said in response to the end of the immunity proceedings. “Israeli citizens have a clear choice: a prime minister who will work for them or a self-employed prime minister. No one can run a state and simultaneously run three serious criminal cases for bribery, fraud and breach of trust.”

Netayanu’s withdrawal allowed prosecutors to start the case against him immediately, although most thought it unlikely a trial would begin before Israelis returned to the polls.

Now that indictments have been presented to the court, “the legal proceedings will start as they would with other accused in Israel,” said Suzie Navot, a professor of constitutional law at the Haim Striks Law School in Rishon LeZion. “It will now be a common criminal case.”

Ruth Eglash contributed to this report.