CHICAGO (CBS) — A federal judge on Wednesday blasted prosecutors, but still revoked bond for a man charged with selling military-style rifles used by gang members that opened fire on Chicago Police officers in a May shooting.

Charles Williams had been free since late July 5 on $4,500 bond on a gun trafficking charge after getting caught selling a handgun to a Bureau of Alcohol Tobacco and Firearms informant.

READ MORE: South Shore Woman Sees Police Activity After Shooting Leaves Man Dead, Only To Find Out It Was Her Own Beloved Brother

But last week, after police sources complained to the Sun-Times that Williams was the source of the weapon used in a May 2 shooting in the Back of the Yards that wounded two CPD officers, prosecutors sought to have Williams held without bond.

Charles Williams (Source: Chicago Police)

Wednesday, Assistant U.S. Attorney Kavitha Babu got what she wanted— Williams was led out of the courtroom by marshals— but U.S. Magistrate Judge Young Kim made it clear that it was not because he believed Williams was a danger to society if he remained free. In fact, the judge said, the government had put Williams’ life in danger.

“I think what the government did here was wrong. You placed Mr. Williams and his family in danger,” Kim said, as Williams longtime girlfriend, seated by the pair’s daughter, sobbed.

“Unfortunately, given your public filing” which named Williams as a source for guns for the La Raza street gang, “Mr. Williams’ presence in his house does pose a danger to his family and any bystanders,” Kim said.

READ MORE: Chicago Weather: Patchy Frost Well Inland

“I can’t have it on my hands that because of what the government did that Mr. Williams is going to be killed or that his family will be in the way and will be killed as bystanders.”

In the filed complaint, Williams was charged with possession of a firearm by a convicted felon, related to the sale of a 9-millimeter pistol in June to the informant that was captured on video.

The informant said that he had traded the same gun to Williams previously for $350 worth of cocaine, and had traded other guns for drugs, though the complaint made no mention of the weapons used in the police shooting a month earlier.

Kim said additional evidence offered by prosecutors showed that Williams had handled four gun transactions— with all four guns provided by government informants. Babu noted that Williams told ATF agents he knew the guns he traded would end up in the hands of La Raza members that were engaged in a bloody war with rival gangs.

Williams sat beside his girlfriend and his daughter during a break in Wednesday’s hearing, rocking the girl in his arms as he waited for Kim to return to the bench. Both remained in the courtroom as U.S. Marshals took Williams away.

“I’m sorry,” he said to his girlfriend as marshals led him out through a side door.

MORE NEWS: Constituent Says She And Others Were Kicked Out Virtual Meeting With Embattled Ald. Jim Gardiner, And Alderman Isn't Providing Answers

(Source: Sun-Times Media Wire © Chicago Sun-Times 2017. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.)