(CNN) — A federal judge has ruled that police in Ferguson, Missouri, violated the Constitution when they told protesters that they had to keep walking and that they couldn’t stand still. 

(CNN) — A federal judge has ruled that police in Ferguson, Missouri, violated the Constitution when they told protesters that they had to keep walking and that they couldn’t stand still.

U.S. District Judge Catherine Perry issued a preliminary injunctionMonday forbidding law enforcement from carrying out the practice because “it is likely that these agencies will again apply this unconstitutional policy.”

Law enforcement agencies adopted the policy on August 18, a few days after protests began following the shooting death of unarmed African-American teen Michael Brown at the hands of a white police officer.

The case was brought by the ACLU after it saw the strategy being practiced as recently as Setember 27. In some cases, officers told protesters they couldn’t stand still for more than five seconds. In others, the protesters were told they were walking too slowly.

Ferguson flash mob disrupts St. Louis symphony

“One person asked plaintiff (in the case) to join her in prayer and police said they could pray while they were walking,” Perry wrote.

The judge said officers have the right to disperse protesters, restrict certain areas from protests, and use other lawful crowd control measures.

Complete coverage of Ferguson

“This injunction prevents only the enforcement of an ad hoc rule developed for the Ferguson protests,” she said.