A Muscoy man was arrested Sunday on suspicion of weapons violations and of accidentally shooting a man in the leg after a person fired a shot at the residence he was in.

Deputies with the San Bernardino County Sheriff’s Department responded to the 3300 block of Otono Court in Muscoy just after midnight on Sunday after reports of a shooting in the residence.

“When the deputies arrived at the residence, they discovered the victim was transported to San Bernardino Community Hospital by a family member,” the Sheriff’s Department said in a press release on Monday.

The man suspected of shooting the victim in the leg, 20-year-old Edgar Ocegueda, was found by deputies, also at the hospital.

Authorities said during an investigation, it was found that earlier in the evening a suspect shot toward Ocegueda’s residence. After that shooting, Ocegueda grabbed a gun and accidentally shot it, hitting the leg of the victim.

Ocegueda was arrested and booked into the Central Detention center on suspicion of negligent discharge of a firearm, prohibited possession of a firearm and possession of a large capacity magazine. He was later released on bail.

The Sheriff’s Department said no suspects have been identified in the initial shooting into Ocegueda’s residence.