TUSTIN, Calif. — A 20-year-old part-time college student was responsible for an hourlong early-morning shooting and carjacking rampage in Orange County on Tuesday that left four dead, including the gunman, the police said.

The man, Ali Syed, began shooting around 4:45 a.m. at the home where he lived with his parents in Ladera Ranch, officials said. He fired multiple times at a young woman in the house, killing her, and fled in his parents’ sport utility vehicle, they said.

Jim Amormino, a spokesman for the Orange County Sheriff’s Department, said the relationship between Mr. Syed and the victim, who was identified only as a woman in her 20s, had not been determined, nor was Mr. Syed’s motive in the killing clear.

But after leaving his parents’ home, Mr. Syed dispensed death and mercy with a baffling randomness, executing some victims with his shotgun while sparing others.