A Ramsey County judge has thrown out gross misdemeanor riot charges against 38 people in connection with a July protest on Interstate 94 in St. Paul that was sparked by the fatal police shooting of Philando Castile.

In a ruling that disappointed police and the city attorney, Judge G. Tony Atwal said Wednesday that although somebody threw rocks and bottles at police, there was no evidence that the defendants in the case had done so.

However, Atwal wrote that evidence exists to uphold misdemeanor charges of unlawful assembly and public nuisance for blocking the freeway.

On Thursday morning, a courtroom in St. Paul was jammed with attorneys and protesters who were arrested on I-94 on July 9 and at a related protest outside the Governor’s residence on July 26. A total of 77 protesters were having their cases heard, while about a dozen attorneys negotiated with city prosecutors over the remaining misdemeanor charges. The mood was ebullient.

“It’s a great win for us,” said Rachel Mueller, 27, of Minneapolis. “To have Officer Yanez charged and to have the riot charges dropped is huge. It shows protesting works.”

Jane Conrad, 55, of Richmond, Minn. was also happy to see her riot charge dismissed.

“We were not involved in any of that conduct, nor do we support it,” she said. “Our values are that of Dr. Martin Luther King.”

Mueller said she expected more than 20 protesters who had their riot charges dropped are prepared to go to trial over their misdemeanor charges. While riot charges were dropped against 38 protesters, eight others have either pleaded guilty, had those charges dismissed earlier, or have not turned up at court hearings and have warrants out for their arrest.

During the night of July 9, about 300 protesters entered the freeway at Lexington Avenue and marched eastward, blocking traffic in both directions while some threw rocks, cement chunks and other items at law enforcement.

Scores of police officers in riot gear used smoke bombs, and eventually tear gas and pepper spray, to disperse the crowd. Police eventually closed the freeway for nearly five hours between downtown St. Paul and Hwy. 280.

Authorities said at least 16 officers were injured. As a result, 46 people were charged with third-degree riot, along with misdemeanor public nuisance and unlawful assembly.

In his ruling, Atwal said simply being at the protest and ignoring orders to leave the freeway does not constitute active rioting. In most cases, there is no direct evidence to prove those charged were throwing items at law enforcement officers.

“Even if Defendant was aware of the violence toward law enforcement personnel, this is insufficient to support a riot third degree charge,” Atwal wrote about defendant Brian Heilman. “Other than the fact that defendant was arrested on the westbound traffic lanes of I-94, the record is void of any fact establishing that the State possesses substantial evidence which would be admissible at trial.”

Jordan Kushner, Heilman’s attorney, said Atwal issued similar rulings for the other 40-plus protesters also charged with riot.

Castile, 36, was shot and killed July 6 by St. Anthony police officer Jeronimo Yanez during a traffic stop in Falcon Heights. The aftermath of the shooting was live-streamed by his girlfriend, Diamond Reynolds. The video was viewed by millions and spurred weeks of protests. Yanez has been charged with multiple felonies, including manslaughter.

The freeway protest came three days after Castile was shot, and it eventually drew about 200 law enforcement officers, including St. Paul police, Ramsey County sheriff’s deputies and the State Patrol.

At a news conference the next day, St. Paul Mayor Chris Coleman and St. Paul Police Chief Todd Axtell called the pelting of officers with rocks, bottles and other items “a disgrace.”

Gov. Mark Dayton said “the occupation and shutting down of Interstate 94 last night were unlawful and extremely dangerous.”

Kushner, one of several attorneys for the demonstrators, called Atwal’s decision a victory for the defendants and others who want to protest.

He said prosecutors filed “an inappropriate, serious charge to make political points and intimidate people from engaging in protest.”

Prosecutors argued that the protesters “would have been aware of the violence toward the police occurring around them and in front of them,” according to Atwal.

But Atwal said the state statute and previous legal precedents do not “impose vicarious criminal liability.”

St. Paul City Attorney Samuel Clark said his office will “consider what the next steps will be” after it reviews the order.

“The nature of what happened that night was dangerous,” Clark said. “Those arrested on the freeway should not have been there in the first place and should have left after receiving lawful dispersal orders from authorities.”

St. Paul police spokesman Steve Linders said what happened that July night was not protesting but instead “dangerous, violent behavior and [they] need to be held accountable for that.”

“We are disappointed in the decision,” Linders said. “We certainly support people’s rights to protest and have their voices heard, but when their actions include violence, that is where we draw the line. Every time the people are on I-94 and disregarded a lawful order for to leave the freeway, they extended the amount of time our officers were put in harm’s way.”

Susan Gaertner, former Ramsey County attorney, who was not involved in the case, said the case was an example “of how difficult it is when you have a large number behaving in a disruptive way and you obviously can’t prosecute the group and … it is very difficult in this kind of chaotic situation to develop evidence specifically against any individual.”

The riot charges could have carried sentences of up to a year in jail, whereas misdemeanor charges result in no more than 90 days and frequently community service with no jail time.

A hearing on the cases is scheduled on Thursday before Atwal in Ramsey County District Court.

Louis B. Hunter of St. Louis Park was the only person charged with a felony for allegedly throwing rocks and construction debris at police. Hunter was charged with two counts of second-degree riot armed with a dangerous weapon, and his bail was set at $50,000. Officers arrested Hunter after seeing him throw rocks and debris at officers, according to the criminal complaint. Hunter has denied throwing any objects.

Staff writer Karen Zamora contributed to this report.