JERUSALEM (JTA) — Israeli Cabinet ministers advanced a bill that would make it a crime to film Israeli soldiers, particularly during clashes with Palestinians, despite objections by the attorney general.

The Ministerial Committee for Legislation approved the measure, proposed by the right-wing Yisrael Beitenu party, on Sunday. The bill makes filming or publishing footage “with intent to harm the morale of Israel’s soldiers or its inhabitants” punishable by up to five years in prison. The prison term increases to 10 years if the intention was to damage “national security.”

The legislation includes both traditional media and social media.

Attorney General Avichai Mandelblit opposes the bill, saying he cannot defend such a law. He also said the Supreme Court would not uphold such a law.

The bill moves to a preliminary reading in the Knesset, reportedly on Wednesday.

Following the reading, the language of the bill likely will be softened as a result of a compromise brokered on Sunday in which the prohibition on filming soldiers will only apply to when there are active clashes and it obstructs soldiers ability to do their job. The rewrite also likely will lessen the jail term to three years.

Israeli soldier Elor Azaria was convicted of manslaughter after he was filmed by a volunteer from the B’Tselem NGO shooting a downed Palestinian assailant in the head in Hebron.

B’Tselem said such a law would not stop it from documenting what it describes as abuse by Israeli soldiers.