A Brooklyn man thought to be urinating on the street in East Flatbush ended up shooting himself in the groin with a Glock 19 handgun police recovered hidden at the scene.

Javier Thomas faces reckless endangerment and weapons possession charges after authorities said he appeared to be urinating at the corner of East 93rd Street and Clarkson Avenue on Saturday afternoon.

RELATED: Police looking for suspect in Brooklyn shooting that left five injured

Uniformed officers patrolling the area in an unmarked van said they noticed Thomas with his back turned at them and pulled over before the approached him.

That's when police said they heard a single gunshot from where Thomas stood. The officers said Thomas started to run away towards 94th Street but cops apprehended him almost immediately.

During his arrest, police saw Thomas had shot himself in his groin but had no gun on him. Investigators canvassing the area soon found a loaded and defaced handgun hidden under the passenger rear tire of a nearby minivan.

Paramedics came to the scene and took Thomas to Kings County Hospital, where he was in custody and in stable condition by Saturday evening.