A pit bull attack led to the accidental killing of a western Massachusetts man with a crossbow, prosecutors said.

It happened in an apartment in Adams, Mass., Wednesday. The two dogs belonged to the victim, Joshua Jadusingh, 27, Berkshire County District Attorney Andrea Harrington told a news conference, according to reports.

She said Thursday the man who fired the crossbow was a neighbor of Jadusingh’s. She called the man a “good Samaritan."

FATAL KENTUCKY PIT BULL ATTACK ON PUG LANE LEADS TO WOMAN'S ARREST FOR MURDER

The neighbor heard Jadusingh's screams for help and retrieved the crossbow he uses for hunting when he saw what was happening, WBZ-TV reported.

Harrington said that the neighbor was standing at the bottom of a staircase when he fired the crossbow at one of the pit bulls standing at the top of the stairs in front of a door Jadusingh was hiding, trying to get away from the dogs, according to the station.

“The neighbor shot the crossbow, hit the dog in the scruff of the neck,” she said. “The dog did not die, but the crossbow, it’s called a bolt, the bolt went through the door and unfortunately hit somebody behind the door.”

The pit bulls had a history of fighting and aggression, the station reported.

NEW JERSEY DOGS, INCLUDING 3-MONTH-OLD PIT BULL, BURNED WITH BLOWTORCH, ANIMAL RESCUERS SAY

Their names were Max and Durma, WAMC-TV reported.

Harrington said the dogs were shot and killed after hurling themselves at officers called to the scene, according to the station.

Jadusingh's young daughter was in the apartment at the time. She was not injured.

Harrington said the neighbor wouldn't be charged.

CLICK HERE FOR THE FOX NEWS APP

“He was actually quite good friends with his neighbor, and he knew that there was a child in the home, and it was a really, really difficult and stressful situation for him to be in and I think he did his best under the circumstances,” she said, WAMC reported.