A gunman killed six people in a drive-by shooting in a southern California college town, spraying bullets from his car until it crashed and he was found dead inside, authorities said on Saturday.
Seven other people were wounded in what the Santa Barbara County sheriff described as a premeditated atrocity and the "work of a madman."
The attack took place late on Friday in the town of Isla Vista near the campus of the University of California at Santa Barbara.
Witnesses reported seeing someone driving a black BMW through the streets and shooting at people in Isla Vista, a beachside community where many college students live.
"We currently have seven people confirmed dead. That includes the suspect and six victims," Santa Barbara Sheriff Bill Brown told a news conference. He did not identify the suspect but said authorities were investigating a possible link with a threatening video made by a young man.
The sheriff said deputies twice exchanged fire with the suspected gunman before his vehicle crashed. He said the man died of a gunshot wound to the head but could not immediately say if he was killed by deputies in the exchange of fire or died of a self-inflicted wound. It also was not known whether he was a UCSB student.
A semi-automatic handgun was recovered from the scene, he said.
"It's obviously the work of a madman," Brown said. "There's going to be a lot more information that will come out that will give a clearer picture of just how disturbed this individual was."
He said authorities were investigating a video posted on YouTube that appeared to be have been made by the suspect. "It would appear that is connected," Brown said.
The video shows a young man complaining bitterly and repeatedly of loneliness and rejection by women, and threatening a mass slaughter of college students and Isla Vista residents.
The sheriff said another news conference would be held on Saturday afternoon.
Robert Johnson, a 21-year-old UCSB student, said the car drove past him at a busy Isla Vista intersection and that he heard "popping noises" that he originally mistook for firecrackers or the car backfiring.
"Then the sound came again, and by that point it had pulled up in front of a convenience store deli, and someone in the car was firing into a crowd of about eight, 10 people that were gathered in front of the store," he said.
"Everyone that was being fired upon, they all jumped and scrambled to run inside the store," he said.
The car had darkly tinted windows and the occupant was not visible, Johnson said.
UCSB President Janet Napolitano said she was "shocked and deeply saddened" by the shooting near the campus.
"Our thoughts and prayers go out to the victims of this tragedy, their families and the entire Santa Barbara community," she said in a statement.
Napolitano, formerly U.S. secretary of Homeland Security, said victims' families still were being notified.
The university was offering services to family members, faculty and students, including counseling, she said.
The incident was the latest mass shooting in the United States, where schools, shopping malls and military bases have been scenes of such crimes.
Last month, a gunman killed three people and himself at the Fort Hood U.S. Army base in Texas, where another gunman killed 13 people in 2009.
In December 2012, 20 children and six adults were killed in a mass shooting at an elementary school in Newtown, Connecticut. Six months before that, a gunman killed 14 people in a Denver-area movie theater.
The deadliest U.S. mass shooting in modern times was in 2007, when a student at Virginia Tech killed 32 people in a shooting spree.
The identities of the dead in Santa Barbara were being withheld pending notification of their families, the sheriff said. Santa Barbara Cottage Hospital was not releasing any details about the conditions of the wounded in Friday's shooting.
About 10 minutes elapsed between the first 911 calls to emergency services and the suspected gunman being found dead in his car, Brown said at the news conference.
Some 23,000 people live in Isla Vista. Many are students at UCSB, which has an enrollment of about 22,000, or at Santa Barbara City College.
College student Brad Martin told a UCSB student newspaper that his girlfriend was "absolutely hysterical" after being approached by the gunman with a weapon she initially was not sure was real.
"She said the next second he raised it up to her face ... and she turned around and started running," Martin told the Daily Nexus. "That's when she heard 'bang, bang, bang' right behind her as she was running."