At least 12 people were killed when a gunman dressed in black walked into a California bar full of college students on Wednesday night and opened fire.
The gunman, who apparently killed himself, threw what is believed to a smoke bomb into the bar in Thousand Oaks, a suburb of Los Angeles, before firing up to 30 times, witnesses said.
He was identified as Ian David Long, a 28-year-old veteran of the US Marines. The motive for his attack is under investigation.
Geoff Dean, sheriff of Ventura County, said his department had "several contacts" with Long over the years, for minor incidents including a traffic collision, and in 2015 when he was beaten up at a local bar. In April this year, deputies were called to his house for a disturbance and found him "acting a little irrationally".
"They felt he might be suffering from PTSD, [given] the fact he was a veteran and had been in the corps," Mr Dean said.
"They called out our crisis intervention team, our mental health specialists who met with him, talked to him, and cleared him."
The sheriff said Long was believed to have been armed with a single handgun — a .45-caliber Glock 21, designed to hold 10 rounds plus one in the chamber. But it had an extended magazine that is illegal in California.
"It appears he walked up to the scene. He shot the security guard that was standing outside. He stepped inside," Mr Dean said.
"It appears that he turned to the right and shot several of the other security and employees there, and then began opening fire inside the nightclub."
A sergeant from the sheriff's office was the first police officer to enter the bar and was met immediately by gunfire. He was declared dead in hospital.
Mr Dean identified him as Ron Helus, a 29-year veteran who was to retire next year.
"Ron was a hardworking dedicated sheriff's sergeant. He was totally committed, he gave his all and tonight, as I told his wife, he died a hero; he went in to save lives, to save other people," he said.
Around midday on Thursday, the body of the slain sheriff's officer was taken by motorcade from the hospital to the coroner's office. Thousands of people stood along the route or pulled over in their vehicles to watch the hearse pass. Firefighters used two ladder trucks to raise a giant American flag over the route.
Helus was a 29-year veteran of the force with a wife and son and planned to retire in the coming year, said the sheriff, choking back tears.
Hundreds of panicked people, many students at Pepperdine University, scrambled to escape the bar, some breaking windows to escape.
US President Donald Trump said he had been briefed on the shooting and praised "great bravery shown by police."
The United States held midterm elections on Tuesday, which were marked by a number of politically motivated violent crimes.
At least 11 people were killed after a man shot Jewish worshippers at a Pittsburgh synagogue.
US yoga studio shooter posted racist, misogynistic videos
US synagogue shooting suspect due in court as congregation mourns
US Muslims start fund-raising to help Pittsburgh synagogue victims
The Borderline bar and grill, a country-and-western bar was hosting a "student night" with dancing lessons, when the gunman opened fire at around 11.20pm.
Pictures and video from the scene show a trail of blood visible on the street and emergency services flooding the area.
"It's a horrific scene in there," Mr Dean said. "There's blood everywhere."
Thousand Oaks is considered one of the safest cities in the country and has a low crime rate.