The Santa Monica police at first said six people had been killed by the gunman. On Friday evening, Sgt. Richard Lewis said the actual figure was four. One of the victims was said to be in critical condition.
The shooting took place about 10 minutes away from where President Obama was attending a private fund-raising lunch before heading to Palm Springs for a meeting with the president of China. He went by motorcade to the Los Angeles airport and flew to Palm Springs about 2 p.m.
The gunman, who was not identified, was described as 25 to 30 years old. His body was spotted lifeless about 200 yards from the library.
The carnage began Friday morning in eastern Santa Monica after the police responded to reports of shots being fired and a house engulfed in flames. The police said that two bodies had been found in the house, and that they were investigating whether those victims were related to the gunman.
From there, the gunman, wielding what the police said was probably an AR-15, hijacked a car driven by a young women and forced her to drive her across town toward the campus. Along the way, he emerged from the car at at least two intersections in this quiet beach town, firing indiscriminately at buildings, a public bus, cars and a police vehicle before ending his rampage in a confrontation with Santa Monica city and campus police officers.
At one point on Friday, the police said they had detained a potential suspect who they thought might have had a role in the shootings. Sergeant Lewis said the person was released and had no involvement in the shooting.
The authorities said the gunman, in addition to carrying the assault rifle, was armed with other weapons, including at least one handgun that was found at the scene.
Witnesses described a morning of terror, chaos and confusion.
Joe Orcutt, who works at the bursar’s office at Santa Monica College, said he went out to investigate after hearing what he first thought was a car backfiring. “He turns and points his gun at me, and at that point I jumped out of the way,” Mr. Orcutt said. “He shot, and I ducked out of the way.”
Witnesses described racing out the back door of the college library after the man walked in and opened fire.
“I didn’t want to take any chances,” said Cyrus Jabbari, 19, a freshman at the college.
Brett Holzhauer, 19, a student who was in the library, said blood was smeared on the walls and floors.
“There were hundreds of rounds of clips laying on the floor,” he said. “It looked like the guy just dropped his stuff right there.”
None of the people who were killed or wounded were immediately identified.
The rampage, starting at the burning house and ending at the library, took about 10 minutes, the authorities said.
Two people were found dead inside the burning house on Yorkshire Avenue. From there, the gunman, who the police said was wearing a bulletproof vest, shot two people sitting in a Ford Explorer; one of them died and the other was taken to Ronald Reagan U.C.L.A. Medical Center, where she was listed in critical condition. He continued to Santa Monica College, where he fatally shot a woman he encountered at the campus before heading toward the library.
Another woman was listed in serious condition at the Reagan hospital. Three other women had minor injuries and were in good condition at the U.C.L.A. Medical Center, Santa Monica.