ARCADIA, Calif.—Authorities arrested a 21-year-old man who barricaded himself inside a home after driving off a winding Southern California mountain road in an apparent attempt to kill himself and his girlfriend.

The woman was not hurt in the crash Saturday evening along Chantry Flats Road in the Angeles National Forest, said Arcadia police Lt. Mike Castro.

A guardrail kept the car from going over a cliff, Castro said. After the crash, the driver, who was carrying a gun, ran into a house in Arcadia near the Santa Anita Dam. The home's residents escaped and called police.

After a standoff lasting several hours, sheriff's SWAT officers entered the home and arrested Patrick Anthony Gonzalez, of Los Angeles, according to Castro.

Gonzalez was hospitalized for unspecified injuries.

Castro said in a statement Sunday that investigators believe Gonzalez "was trying to commit suicide by driving off the road over the cliff, thus trying to murder his passenger."

No charges were immediately filed. An investigation was ongoing.