A federal judge on Wednesday temporarily blocked enforcement of some new South Dakota laws that aim to prevent disruptive demonstrations against the Keystone XL pipeline.

A lawsuit spearheaded by the American Civil Liberties Union against Gov. Kristi Noem and state Attorney General Jason Ravnsborg alleges that the legislation chills protected speech. In issuing a preliminary injunction halting several provisions of the legislation, U.S. District Judge Lawrence Piersol said the ACLU is likely to win most of its challenges to the bill "with the possible exception for direction of another person participating in a riot to use force or violence."

Piersol added that that protesters must be allowed to plan and seek public support and money "before and in anticipation" of the next construction season. Conversely, supporters of the pipeline should also have the opportunity to respond rather than waiting for confrontation during actual construction, the judge said.

Get Breaking News Delivered to Your Inbox

"We're glad the court recognized that these vague and overbroad laws threaten the First Amendment rights of South Dakotans on every side of the issue," said Stephen Pevar, an ACLU attorney.

The legislation hastily passed in March by the Republican-dominated Legislature allows officials to pursue criminal or civil penalties against demonstrators who engage in "riot boosting," defined in part as encouraging violence during a riot. It's meant to head off Keystone XL protests like those mounted against the Dakota Access pipeline in North Dakota that resulted in 761 arrests over a six-month span beginning in late 2016.

Kristin Wileman, Noem's spokeswoman, said the "governor and her team" are reviewing the ruling and won't be making public comments as long as the case remains active. Noem has said the legislative package was developed to address problems caused by "out-of-state rioters funded by out-of-state interests."

The 1,184-mile (1,900 kilometer) pipeline is intended to ship up to 830,000 barrels a day of Canadian crude through Montana and South Dakota to Nebraska, where it would connect with lines to carry oil to Gulf Coast refineries. The $8 billion project has the backing of President Donald Trump but is being fought in the courts by opponents.

John Harter, board chair of Dakota Rural Action, one of several activists groups involved in the suit, said the government has dismissed Native Americans, farmers, ranchers and others who oppose the Keystone XL pipeline.

"Our opposition to the pipeline construction may agitate Gov. Noem, but the First Amendment guarantees us the right to make our voices heard," he said.

Piersol filed a separate order earlier Wednesday removing Pennington County Sheriff Kevin Thom as a defendant. The ACLU maintained that Thom would be enforcing laws that amount to an unconstitutional infringement on free speech. Piersol said Thom is not making any choices on state policy.

Pennington County is one of eight counties in South Dakota along the pipeline route.