SAN DIEGO -- A man sat calmly with a gun on his lap and opened fire on seven people enjoying a birthday party at an apartment complex pool near the University of California, San Diego, killing one woman before officers fatally shot him, witnesses and authorities said.

The suspect, Peter Selis, 49, shot four black women, two black men and one Latino man Sunday, police said. Investigators don't yet know why Selis, who was white, started shooting, Chief Shelley Zimmerman told reporters.

The chief made a point of mentioning the race of the victims. When asked if detectives were investigating the shooting as a potential hate crime, Zimmerman said they were exploring all possible motives.

Several victims underwent surgery, and some were in critical condition late Sunday, she said. One man was taken to the hospital after he broke his arm running away.

Rikky Galiendes, 27, said he heard between eight to 10 gunshots around 6 p.m. and looked outside his sixth-story apartment in La Jolla, a quiet coastal community known for its pristine beaches and cliffside mansions. He spotted a man bleeding and running near the pool below.

Galiendes said he called out to ask if the man needed help when his roommate grabbed him, yanked him down and pointed toward a man sitting in a chair with a gun.

"When we looked over the balcony, he was just sitting down with a gun on his lap," Galiendes said. "He was calm, you know. I mean from my perspective, the guy was ready to do whatever he was going to do. He shot at people having a good time and having a party."

Galiendes and his roommate ran back inside and called police.

A police helicopter arrived first, and the pilot reported seeing multiple victims on the ground and that Selis appeared to be reloading in the pool area, the police chief said.

Three officers arrived and shot Selis after he pointed a large-calibre handgun at them, she said.

Police believe Selis and one of the partygoers lived at the complex in the beach community north of downtown San Diego, police said.

Selis, a father who worked as a mechanic at a Ford dealership, filed for federal bankruptcy protection in October 2015, listing $14,000 in assets and $108,000 in liabilities, according to court records.

"This is truly a horrific act of violence," San Diego Mayor Kevin Faulconer said at a news conference. "Our entire city, all of our thoughts and prayers, all San Diegans' thoughts and prayers, are with the victims and their families tonight."

Galiendes and his roommate stayed indoors until neighbours yelled that it was safe to come out. He said the scene was horrifying.

"As soon as I heard the gunshots, I had goosebumps and the whole thing was really emotionally draining -- seeing blood everywhere, seeing bodies on the ground, hoping they survived, seeing bloody footsteps you know of people who ran away. There was just so much blood. It was so surreal."

Galiendes, a student at UC San Diego, said he has lived in the complex since September.

"It was chilling," he said. "La Jolla is known to be really safe, and this is a family neighbourhood."

Associated Press reporters Elliot Spagat and Julie Watson in San Diego and Christopher Weber in Los Angeles contributed to this report