A gunman killed 12 people including a sheriff's deputy when he opened fire on revelers in a crowded country and western bar in Los Angeles late on Wednesday night, police said.
The gunman was also killed, Ventura County Sheriff Geoff Dean told a news conference early on Thursday, though it was not immediately clear by whom.
An unknown number of people were wounded after the shooting at the Borderline Bar and Grill, a popular venue with college students and local young adults for parties and dancing in the suburb of Thousand Oaks.
It was the third mass shooting in the United States in under two weeks, six days after the death of two women at a yoga class in Tallahassee, Florida and 12 days after a gunman killed 11 worshippers at a synagogue in Pittsburgh, shouting "All Jews must die".
"It's a horrific scene in there," Dean said. "There is blood everywhere and the suspect is part of that.
"We don’t know who shot anybody at this point."
The dead officer was identified as Sergeant Ron Helus, a 29-year veteran of the department, Dean told reporters. Helus and a California Highway Patrol officer were the first to arrive at the bar and went inside just before 11:30 pm PST (0730 GMT).
After a lull of about 15 minutes, more officers went inside and found the suspected gunman dead of a gunshot wound. It was not clear whether he killed himself or was killed by officers, Dean said.
President Donald Trump, who has resisted a surge in calls for tougher gun controls since 17 students were shot dead at Stoneman Douglas High School in Florida earlier this year, said on Twitter that he had been "fully briefed on the terrible shooting in California."
"Great bravery shown by police," Trump tweeted. "God bless all of the victims and families of the victims."
Jerry Nadler, the top Democrat on the House Judiciary Committee, said lawmakers would get to work on legislation including universal background checks when the House of Representatives convenes in January with a Democratic majority.
"We must find a way to stop the senseless, and many times preventable killings that are robbing our country of innocent lives," he tweeted.
A witness to the shootings, Taylor Von Molt, 21, who said she was a promotor at the bar, said the gunman wore a black mask with a bandana covering the bottom of his face, and a black hoodie.
"I heard what I thought was a balloon pop," she told CNN.
"I was confused because we didn’t have any balloons. I saw him, then I saw him fire his weapon one more time. I ran to the nearest exit and tripped and fell on the way and people kept running on top of me."
Von Molt said she and others from nearby California Lutheran University often gathered on Wednesday night to line dance to country music. Many of those at the bar were regulars, she said.
Witness John Hedge told ABC News he was near the front door of the California bar when the shooting began.
"I just started hearing these big pops. Pop pop pop," he said. "There was probably three or four. I hit the ground. I look up. The security guard ... was shot, he was down. The gunman was throwing smoke grenades all over the place. I saw him point to the back at the cash register and he just kept firing."
Dean estimated that 10 to 15 people, including one with a gunshot wound, had gone to area hospitals. He said he thought their injuries were minor, and that most of them were likely injured as they escaped, some by breaking windows.
"There were people hiding in restrooms, people hiding in attics," Dean said.
Dean said that the shooter had a handgun and that at this early stage in the investigation he believed he had only one gun. Witnesses described a rapid sequence of shots that it made them think he was using a semi-automatic weapon.
Thousand Oaks was named the third-safest city in the United States for 2018 by the website Niche.
"I’ve learned it doesn’t matter what community you’re in," Dean told reporters when asked if he was surprised this happened in Thousand Oaks. "It doesn’t matter how safe your community is. It can happen anywhere."
None of the civilian victims were identified. Helus died while being treated at an area hospital several hours after he was shot, Dean said.