Israeli Prime Minister Benjamin Netanyahu violated the law by saying he would get personally involved in a judicial overhaul plan, the attorney-general said on Friday.

In the face of intensifying protests against the proposed changes, Netanyahu said on Thursday he was putting aside all other considerations and would do “anything it takes” to reach a solution.

Netanyahu, who is on trial on corruption charges which he denies, said his hands had been tied but a law amended on Thursday to limit the circumstances in which a prime minister can be removed gave him more space for maneuver.

However, Attorney-General Gali Baharav-Miara, in a letter addressed to Netanyahu, disagreed.

“The legal situation is clear: you must refrain from any involvement in initiatives to change the judiciary, including the makeup of the committee for judicial appointments, as such activity is a conflict of interest.”

“Your statement last night and any action you take in violation of this matter is illegal,” Baharav-Miara said.

The letter followed Baharav-Miara’s earlier warnings that Netanyahu must stay out of his coalition’s push for a judicial overhaul because of what she deemed a conflict of interest arising from his trials.

In a message distributed by the ruling Likud party, an unnamed source close to Netanyahu denied the prime minister violated any laws or conflict of interest agreements in his statement and said it had no repercussions on his trial.

The source said it was incumbent on the premier to try and reach a wide consensus during a time of national crisis that carried implications for the country both domestically and abroad.

Far-right National Security Minister Itamar Ben-Gvir accused the attorney-general, appointed by the former centre-right government, of acting as de facto head of the opposition.

“If Ms Baharav-Miara wants to make decisions on behalf of elected officials, she is welcome to form a party and run for parliament,” he wrote on Twitter.

Netanyahu’s religious-nationalist coalition has been pursuing changes to the judiciary that would give the government sway in choosing judges and limit the Supreme Court’s power to strike down laws.

Proponents say the plan would rein in Supreme Court overreach and restore the balance between the branches of government. Critics say it would weaken the courts, endanger civil liberties and harm the economy.

The proposed plan has sparked weeks of nationwide protests and drew concern among the country’s Western allies.