A federal judge on Thursday ruled Florida's new "anti-riot" law unconstitutional and unenforceable. The law was championed by the state's Republican Governor Ron DeSantis as a way to quell violent protests.

According to the judgment by US District Judge Mark Walker, the recently-enacted law is "vague and overbroad" and amounted to an assault on First Amendment rights of free speech and assembly as well as the Constitution's due process protections.

People engaged in peaceful protest or innocently in the same area when a demonstration turned violent could face criminal charges and stiff penalties under the law, the judge said, according to the Associated Press.

"If this court does not enjoin the statute's enforcement, the lawless actions of a few rogue individuals could effectively criminalize the protected speech of hundreds, if not thousands, of law-abiding Floridians. It unfortunately takes only a handful of bad actors to transform a peaceful protest into a violent public disturbance," Walker wrote in the judgment, according to AP.

The lawsuit was filed against DeSantis and other state officials by the NAACP Florida Conference, Dream Defenders, Black Lives Matter Alliance Broward, and other groups who argue the law appears specifically aimed to halt protests by Black people and other minorities.

The measure was passed earlier this year by the GOP-led Legislature and signed into law in April by the governor. It was a reaction to demonstrations around the country following last year's killing by Minneapolis police of George Floyd.

The governor's lawyers have argued that the law continues to allow peaceful protest but is an effort to draw a sharp distinction between that and a violent riot. Walker found that argument unpersuasive.

"Because it is unclear whether a person must share an intent to do violence and because it is unclear what it means to participate, the statute can plausibly be read to criminalize continuing to protest after violence occurs, even if the protestors are not involved in, and do not support, the violence," the judgment said.

"The statute can also be read to criminalize other expressive activity, like remaining at the scene of a protest turned violent to film the police reaction," it added.

DeSantis can appeal the ruling to the Atlanta-based 11th US Circuit Court of Appeals.

The law, also known as HB1, stiffens penalties for crimes committed during a riot or violent protest. It allows authorities to detain arrested protesters until a first court appearance and establishes new felonies for organizing or participating in a violent demonstration.

It also makes it a second-degree felony, punishable by up to 10 years in prison, to destroy or demolish a memorial, plaque, flag, painting, structure, or other objects that commemorate historical people or events.

In addition, the measure requires that local governments justify any reductions in law enforcement budgets.

(With AP inputs)