An off-duty police detective fatally shot a mugger in Brooklyn late Sunday night. the man hit the cop in the head with a cane then the cop pulled out the gun and shot the man. Click below to find out more.

@WiLMajor

The incident unfolded on Grove St. near Broadway in Bushwick about 11:50 p.m. Two men tried to rob the cop, who was walking to the subway to go to work at Brooklyn North Nightwatch, police said.

The bandits demanded, “Run your pockets,” a source said.

“One strikes him over the head with a cane, knocking him to the ground, and the other simulates a gun,” the source said. “When he’s down, he identifies himself as a police officer.”

The confrontation escalated, according to the source.

“He fires once at the guy, striking the guy who hit him with a cane, and the guy who simulated the gun flees,” the source said.

The mortally wounded man was taken to Woodhull Hospital, where he died at 12:30 a.m. Monday. His name was not immediately released.

The officer was taken to Wyckoff Hospital for treatment of psychological trauma. His identity was unavailable.

The second suspect was being sought.

The scene of the shooting was swarming with detectives early Monday.

The 83rd Precinct incident marked the third time this month that cops have fatally shot someone in Brooklyn.

Police killed gun-toting carjacker Christopher Kissane in Cypress Hills on Jan. 26.

On Jan. 12, police shot and killed Duane Browne behind his East New York home. It was discovered later that he was packing heat to defend his half-brother, a suspected drug dealer who was being robbed at gunpoint.

DN