Just days after an NYPD officer was assassinated, the city's largest police union is ripping a Brooklyn judge for releasing a man who allegedly attacked an officer. 

The NYPD says the incident happened inside the 83rd precinct station house in Bushwick Saturday morning.

Investigators say Kurdel Emmanuel walked into the stationhouse and asked about a friend who had been arrested, then got into a fight with an officer and tried to take her gun from the holster.

Emmanuel was arrested, but later released without bail despite being charged with felony counts of assaulting an officer and robbery. 

Sources say Emmanuel has a history of emotional problems, and in a statement the PBA says Emmanuel indicated he would've shot officers if he had gotten control of the gun.