An off-duty correction officer saved a homeless man from an attacking pit bull in Bed-Stuy yesterday by shooting it in the head.

The dog began attacking the man—apparently first biting him in the arm—at Herkimer Place and Perry Place around 1:20 p.m. The commotion caused correction officer Anthony Davis, who was not on duty at the time, to run over.

“He was bleeding a lot and screaming,” Davis told the Post. “I tried to get him off the guy by pushing the dog and kicking him, but he wouldn’t let go. He had a tight lock on the guy’s chin and he wouldn’t let go.”

Davis told the tabloid that he first tried to fight the dog off, but eventually realized the animal had no intention of detaching her teeth. He shot the pit once in the head with his 9mm pistol, killing her immediately.

“I’ve had dogs since I was a kid — I had to make the decision to save that man’s life,” he said. "I love dogs."

Davis was not hurt, but it did take several minutes to unclench the dog's jaws from the man, who was not identified. He was taken to New York Methodist Hospital, where he was treated for bites.

The Daily News reports that the dog belonged to a second homeless man who had been drinking with the victim. Witness Rasheed Shaabazz tells the News that Davis "had to" shoot the dog, adding, "The dog was going bananas."

This is just the most recent violent incident involving a homeless person's dog this summer. Last month two pedestrians in the East Village were attacked by dogs believed to belong to homeless people. And in 2012, an NYPD officer shot a pit bull who belonged to a man passed out on the street.