California police killed a homicide suspect when he shot two hostages in his trunk after an hour-long chase and shootout in the Mojave Desert on Friday.

The unidentified suspect, who was being sought in a predawn slaying and assault, posted to Facebook during the chase, which began in Ridgecrest, about 150 miles north of Los Angeles, Kern County Sheriff Donny Youngblood said at a news conference, KERO-TV reported.

The gunman had called police and threatened to kill officers and "wreak havoc."

Police shot the gunman dead around 8:15 a.m. when he pulled over on U.S. Route 395, several miles north of Highway 58, and fired into the trunk, wounding a man and woman inside, KABC-TV reported.

During the 30-mile pursuit east of the Sierra Nevada, the gunman fired a shotgun and handgun at deputies and officers from the Ridgecrest Police Department and the California Highway Patrol, but none was hurt.

The suspect pulled over twice, and once his trunk popped open. A deputy reported seeing two people inside.

The wounded hostages were taken to Antelope Valley Hospital.

"We believe they are going to survive," Youngblood said.

The condition of the man wounded during the early morning Ridgecrest shooting was not immediately known. Youngblood said the gunman knew all of his victims.

The drama began around 5:15 a.m., when the suspect called police.

"He said he wanted to kill police officers, but they had too many guns," Youngblood said. "He said he had a package, and he was going to wreak havoc."

Two hours later, a Kern County sheriff's deputy began following a black Dodge Dart wanted in connection with an assault with a deadly weapon, which subsequently became a homicide. A woman was killed and a man wounded in an apartment in Ridgecrest, a city of about 27,000 people adjacent to the Naval Air Weapons Station China Lake.

The suspect fired as he fled, and the deputy gave chase, joined by other officers. The gunman fired "numerous times" at officers and passersby, sheriff's spokesman Ray Pruitt told the Los Angeles Times.

Police closed a 10-mile stretch of Highway 395 and Kramer Junctio, and Ridgecraft schools were temporarily locked down.

"Everyone is very shook up and concerned in Ridgecrest," Mayor Dan Clark told the Times. "This is a small town, and things like this just don't happen here."