A US man accidentally killed his 38-year-old girlfriend with a homemade cannon when the contraption went off and fired a projectile into their mobile home, police said.

It was unclear if Richard Dale Fox, 39, fired the cannon deliberately, a spokesman said, adding that the couple's four-year-old daughter and three other people were in the trailer at the time.

Fox, who had been drinking, was "freaking out" when emergency responders arrived at the scene in Potrero, near the Mexican border in southern California.

The couple's young daughter and three other adults were not injured when the cannon went off for an unknown reason in the early hours, said local homicide detective David Martinez.

The girlfriend, whose identity was not released until relatives had been informed, died of shrapnel wounds at the scene, he said.

Doctors took Fox to hospital in San Diego for treatment for leg injuries he suffered when the makeshift mortar went off. He was then arrested on suspicion of detonating an explosive device in a manner resulting in death.

Initially the incident was reported as an accident, but Martinez said Fox's motives were unclear, telling reporters it was "too early to say it was accidental."

The exact nature of the homemade cannon or the projectile involved were not immediately clear, but it apparently involved explosives taken from fireworks, Martinez said.

The daughter was handed over to child protection services.

[Image via Shutterstock.com.]