A dog was shot while alerting a homeowner that masked gunmen were attempting to rob them late Wednesday, according to police.

The victim, who was also shot, was taken to a hospital where he is talking to investigators. The dog was taken to the vet, where it is being treated.

Detectives said the man was in his basement when he heard his dog barking upstairs. When he went upstairs to see what was going on, the man encountered two gunmen inside his home. There was a brief struggle, and the man was shot in the groin area. The victim say he believes that the gunmen shot his dog as they were running away.

Police believe the motive was robbery. The victim’s roommates were not at home at the time of the incident.

Detectives are still investigating.