A Massachusetts man accidentally killed his neighbor with a crossbow while trying to save him from a dog attack on Wednesday, authorities said.

According to the Berkshire District Attorney's Office, police were called to an apartment in the town of Adams over reports of a mauling by two pit bulls.

Police found the dogs "engaging in a volatile confrontation," and they then "turned the attack onto responding officers." The dogs, which were said to have a history of acting aggressively, were killed by the officers.

Inside the apartment, police found the body of an adult man, 27-year-old Joshua Jadusingh, who had been killed by a crossbow. A child, who was unharmed, was found in another room.

Authorities said they believe a neighbor heard the mauling in progress, called the police, and then entered the apartment and shot at the dogs with a crossbow.

"The arrow struck one of the dogs, went through a door, and then struck the individual being mauled as he was attempting to barricade himself from the attack," the district attorney's office said.

Jadusingh's death is being treated as an accident and the neighbor is cooperating with authorities, they added.

The neighbor has not been publicly identified.