The Israeli prime minister, Benjamin Netanyahu, has been formally indicted in court on corruption charges after he withdrew his request for parliamentary immunity from prosecution.

Netanyahu was in Washington for meetings with the US president, Donald Trump, ahead of the release of the long-delayed Israeli-Palestinian peace plan when Israel’s attorney general filed the charges in a Jerusalem court.

The attempt to obtain immunity seemed doomed to fail from the start since Netanyahu, who denies any wrongdoing, lacked sufficient votes in the legislature for approval.

The request for protection from prosecution had effectively blocked the filing of the indictment until now.

As proceedings move toward trial, the timeline remains unclear and it could take months or years.

In addition to his legal battle, Netanyahu is fighting for his political life in an election on 2 March, Israel’s third in less than a year after inconclusive ballots in April and September.

Netanyahu, Israel’s longest-serving prime minister, said in a statement that an immunity debate in parliament would have been a “circus” and that he did not want to take part in this “dirty game”.

With public attention in Israel focused on events in Washington, Netanyahu’s White House meetings seemed likely to overshadow his latest legal woes.

The veteran rightwinger is under no legal obligation to resign.

Netanyahu’s main rival, the centrist former general Benny Gantz, made the prime minister’s legal troubles a centrepiece of his campaigns in two Israeli elections last year.

Gantz made a brief trip to Washington to discuss the peace plan with Trump, and had rushed back to Israel expecting to lead the parliament debate against granting Netanyahu immunity.

“Netanyahu is going to trial – we have to move on,” Gantz said after Netanyahu pulled his immunity request.

“The citizens of Israel have a clear choice: a prime minister who works for them or a prime minister busy with himself. No one can manage the country and in parallel manage three serious criminal cases,” Gantz said in a tweet.

The corruption charges marked the first criminal indictment against a serving Israeli prime minister. The charge sheet was first published by Israel’s attorney general in November following a long-running investigation. The charges included bribery, breach of trust and fraud.

Netanyahu is suspected of wrongfully accepting $264,000 worth of gifts, which prosecutors said included cigars and champagne, from tycoons and of dispensing regulatory favours in alleged attempts for improved coverage by a popular news website.

Netanyahu could face up to 10 years in prison if convicted of bribery and a maximum three-year term for fraud and breach of trust.