A federal judge has dismissed charges against a Los Angeles protester who was accused of assaulting an officer with a cloth hat, with an order saying the government acted in “bad faith”. The man had spent six months in jail awaiting trial.

Jonathon Redondo-Rosales, a 36-year-old TikTok content creator and US citizen, had been in custody since his arrest at a 2 August protest against the Trump administration’s immigration crackdown.

In her dismissal on Monday, the US judge Cynthia Valenzuela issued a strong rebuke of the US government’s handling of the case, noting discrepancies in the government’s account of events and that Redondo-Rosales had documented injuries he himself endured during the incident.

The case is one of many pursued by the Department of Justice against people accused of assaulting federal immigration officers that have fallen apart in courts across the US.

The charges stemmed from a small protest near a federal courthouse in downtown LA. Redondo-Rosales was accused of assaulting an officer of the Federal Protective Service (FPS), a branch of the Department of Homeland Security (DHS), identified as ZC in court records.

Video of the encounter captured Redondo-Rosales standing and dancing in front of a government vehicle exiting the federal building, with the car slowly making contact with Redondo-Rosales, the judge summarized in her ruling. Redondo-Rosales then briefly rolled onto the hood of the car before regaining his footing on the ground.

Five armed FPS officers in body armor and helmets with face shields then moved toward him. As officer ZC “lunged” toward Redondo-Rosales with his “arms outstretched”, Redondo-Rosales removed his sun hat, which had fallen in front of his face, the judge wrote.

As the protester moved backward, his hand holding the hat swung toward ZC, “causing the hat to make contact” with the officer, the judge said. Redondo-Rosales then fell backward as officers closed in on him and restrained him against the ground while he was flailing. Officers sprayed him with a chemical irritant while he was pinned down, his attorneys have said, and he sustained cuts and bruises, with photos from the scene showing his face bloodied.

The judge noted discrepancies in officers’ statements that were highlighted by Redondo-Rosales’s lawyers. Following Redondo-Rosales’s arrest, ZC provided a statement saying Redondo-Rosales had hit him in the face with a “closed fist”, which prosecutors later walked back by saying the defendant had “swatted” at officers, defense lawyers said. Videos from the scene do not show Redondo-Rosales hitting the officer with a closed fist.

Jonathon Redondo-Rosales during his arrest at a protest on 2 August in Los Angeles. Photograph: Courtesy of Katherine McBroom

Valenzuela’s ruling noted other problems with the prosecution. In January, Redondo-Rosales’s attorneys moved to request materials related to a different case in which the government said ZC was assaulted by another protester. That case was dismissed after it was revealed that ZC had not previously disclosed that he was convicted of a harassment offense in 2021.

Redondo-Rosales’s attorneys also sought use-of-force and personnel records from ZC and other officers who arrested Redondo-Rosales. US prosecutors, the judge noted, opposed the requests for more records and said ZC would not be called as a witness in Redondo-Rosales’s trial, despite being the alleged victim.

As Redondo-Rosales’s trial date approached, prosecutors filed a motion to dismiss the case “without prejudice”, meaning the US could re-file charges at a later date. They argued that the dismissal was needed since Redondo-Rosales had an unresolved parole violation in another county.

The judge rejected prosecutors’ explanation for the dismissal, saying the government had known since August about the alleged parole violation and had opposed Redondo-Rosales’s request for release in September so he could address the parole matter.

The argument that charges needed to be dismissed so that a minor state court matter could be addressed was “plainly meritless”, the judge wrote, and “offered in bad faith”.

The government, it appeared, had “sought dismissal to gain a tactical advantage”, Valenzuela wrote. “The Government faced the possibility that it would have to disclose personnel files of several FPS officers, including one who seemingly made misrepresentations, or at least omissions, to his employer and potentially federal agents. Dismissal without prejudice would eliminate these risks for the Government, allowing it time to regroup, refine its evidence, and refile at a more favorable moment.”

Allowing the government to re-charge Redondo-Rosales would be tantamount to permitting US attorneys to commit “prosecutorial harassment”, Valenzuela said.

Jonathon Redondo-Rosales after his recent release from jail. Photograph: Courtesy of Jonathon Redondo-Rosales

The judge ordered the case dismissed with prejudice, meaning it cannot be re-filed. The judge further said the “right to protest is a core first amendment protection”, and allowing prosecutors to re-charge Redondo-Rosales “risks sending a dangerous signal: that when officials are confronted with protest or criticism, they may respond with aggressive tactics and then deploy criminal charges that can be imposed, withdrawn, and revived at the Government’s discretion”.

“That signal alone is sufficient to chill lawful protest,” Valenzuela continued. “The Court cannot permit a system in which prosecutorial discretion is used to impose punishment without adjudication, particularly when applied in the context of those protesting the government’s activities.”

Spokespeople for DHS and the US attorney’s office in Los Angeles, which prosecuted the case, did not respond to inquiries on Tuesday. ZC, the officer, has not been publicly identified.

Katherine McBroom, Redondo-Rosales’s attorney, celebrated the judge’s ruling in a statement, saying: “This case is a prime example of federal prosecutors marching in lock step with the current administration’s efforts to chill dissent. Mr Redondo-Rosales was lawfully protesting … immigration policy when he was struck by a government vehicle and then tackled and beaten by three other officers in SWAT gear.”

“When the government realized they were going to lose, they concocted a reason to postpone the case to try to fix it. Thankfully, their motives were disclosed and their efforts failed,” McBroom said.

Redondo-Rosales was released on Friday after the government’s first dismissal motion, McBroom said in an interview: “He is relieved and getting reacclimatized to being back in the community.”

She said she hoped the judge’s clear rebuke of prosecutors could be helpful to others facing charges under similar circumstances: “We cannot weaponize prosecutions to chill free speech and dissent.”