Media playback is unsupported on your device Media caption "We heard a loud bang which sounded like a shotgun or a small bomb"

At least five people are dead and several others injured after a gun rampage in the beachfront city of Santa Monica, California, police say.

The attack began at a house and ended on a college campus where police say they shot the gunman in the library.

Police initially put the death toll at six, but later revised it to five people dead, including the shooter.

The gunman was in his late 20s and had been carrying an assault-style rifle, say witnesses.

President Barack Obama was at a fundraiser not far from where the shooting unfolded just before noon on Friday.

'Boom, boom, boom'

The gunman, dressed in black and wearing an ammunition belt and bullet-proof jacket, began by firing shots at the house, witnesses said.

We saw a woman get shot in the head Trena Johnson , Witness

The property was then engulfed by fire although it is not clear how the blaze started.

The Los Angeles Times reports that the first two victims were the gunman's father and brother.

Neighbour Jerry Rathner said she witnessed the shooting from her veranda, the Associated Press reported.

The gunman then walked to the street corner, pointed his gun at a driver and told her to pull over.

He signalled to another car with a female driver to slow down and fired into the car several times.

Ms Rathner said she rushed to help the victim and saw she had a shoulder injury.

"He fired three to four shots into the car, boom, boom, boom, right at her," Ms Rathner said.

Authorities say the violence then moved to a street corner near Santa Monica College where the suspect fired at passing vehicles.

The gunman then entered the campus where he is said to have shot a woman as he made his way toward the college library, where students were studying for final exams.

"We saw a woman get shot in the head," administrative assistant Trena Johnson told the Associated Press. "I haven't been able to stop shaking."

Image caption Santa Monica College, which has about 34,000 students, was placed on lockdown

Witness Lisa Peters told the BBC she was at the campus radio station when they received a call that shots had been fired.

"We were on lockdown and we all tried to remain calm. I was there for about two and a half hours, but it seemed much longer than that," she said.

"Suddenly I heard police and swat teams yelling and saying to us that we had to evacuate.

"It was very dramatic. On leaving the campus, we walked right past a body which we think was the gunman."

Police Chief Jaqueline Seabrooks said the gunman entered the college library and fired at people but did not hit anyone.

"The officers came in and directly engaged the suspect and he was shot and killed on the scene," she said.

Student Jimes Gillespie, 20, said he saw a car riddled with bullet holes, shattered glass and a baby seat in the back.

Authorities also took into custody a second man dressed in black with the words "life is a gamble" on the back of his shirt.

"We are not convinced 100% that the suspect who was killed operated in a solo or a lone capacity," Chief Seabrooks added.

Three women were taken to the Ronald Reagan UCLA Medical Center, where a doctor said one patient had died, one was undergoing surgery and the third was in a serious condition.

Three more patients were taken to the UCLA Medical Center Santa Monica to be treated for minor injuries.

The shooting unfolded a few miles from where President Obama was speaking at a political fundraiser.

The Secret Service, which protects the US president, said the incident did not affect his schedule.