A Brooklyn judge put a nut job back on the street without bail — despite being told that the man had claimed voices in his head drove him to grab for a cop’s gun and that he had admitted he could have “killed everybody in the room” had he gotten the weapon, The Post has learned.

An official transcript shows that in addition to rejecting a request for $250,000 bail, the judge questioned prosecutor Patrick Cappock’s assertion that his office would seek a maximum prison sentence due to the case’s “extremely violent nature.”

“Really?” she asked.

The stunning Sunday exchange took place four days after Bronx cop Miosotis Familia was fatally shot by a man with a history of mental problems as she worked in an NYPD truck.

The Patrolmen’s Benevolent Association on Friday demanded that court officials demote Baily-Schiffman to the Civil Court seat to which she was elected.

PBA President Pat Lynch noted that Baily-Schiffman on Sunday also freed without bail a man accused of threatening to kill a Catholic nun in church and two men charged with using racial slurs before punching a black man who was walking with a white woman.

One of the men charged in the latter case had 23 prior arrests and allegedly threatened one of the cops who busted him in the hate-crime assault, Lynch said.

Prosecutors sought $25,000 bail in the case involving the nun and $50,000 bail for each man charged in the bias case.

Lynch said Baily-Schiffman’s rulings “demonstrate that she is not only grossly unfit to preside over any criminal matter, but also unfit to remain on the bench in any capacity.”

At Emmanuel’s arraignment Sunday, Cappock detailed the videotaped statement the suspect gave cops at the 83rd Precinct station house.

Emmanuel, 29, said he went to the station the day before to check on Tyanna Berry, who had been arrested for allegedly violating an order of protection, according to Cappock

“When I saw I wasn’t getting any attention, I just blacked out,” Cappock quoted Emmanuel as saying.

“I went for the officer’s gun, because they were not listening to Tyanna. When things don’t go right, I hears voices in my head telling me that it’s time to eat. I just do what the voice tells me.”

Emmanuel also allegedly admitted, “If I got hold of the gun, I could have possibly killed everybody in the room, and then the police would have killed me, or I could have shot myself in the head to show that the issue with Tyanna needs attention.”

Still, Baily-Schiffman denied Cappock’s request to set bail at $250,000 and instead sided with Emmanuel’s Legal Aid lawyer, Matthew Scott, who noted his client had no prior arrests and was receiving medication and therapy from Kings County Hospital.

Baily-Schiffman didn’t return a request for comment, but a state courts spokesman said the judge had “made her decision based on the facts and circumstances of the case as she saw them.”