The gunman was tall and wore all black with his face partly covered, witnesses told TV stations. He first shot a security guard standing outside the Thousand Oaks bar, then went in and opened fire on staff members and patrons, a sheriff said.

The suspect in the Thousand Oaks nightclub shooting has been identified as Ian David Long, a veteran who neighbours said had PTSD. Source: Facebook

Screaming in fear, patrons rushed for the exits, ducked under tables and hurled barstools to smash second-floor windows and jump to safety as gunfire erupted at the Borderline Bar & Grill, a hangout popular with students from nearby California Lutheran University.

Police say the shooter, 28-year-old Ian David Long, a former machine gunner and veteran of the war in Afghanistan was interviewed by police at his home last spring after an episode of agitated behavior that they were told might be post-traumatic stress disorder.

His motive behind the attack on Wednesday night was under investigation, authorities said.

The dead included 11 people inside the bar and a veteran sheriff’s sergeant who was the first officer inside the door, Ventura County Sheriff Geoff Dean said.

Witness Sarah Rose DeSon told ABC’s Good Morning America how she dropped to the floor as the gunman stormed the bar.

People cry as a police motorcade escorts the body of slain Sergeant Ron Helus from hospital n Thousand Oaks, California after a gunman opened fire. Source: AP Photo/Mark J. Terrill

Shooter was carrying an ‘illegal’ weapon

Long was armed with a Glock 21, a .45-caliber designed to hold 10 rounds plus one in the chamber, according to the sheriff. But it had an extended magazine — one capable of holding more ammunition — that is illegal in California, Sheriff Dean said.

The killer also deployed a smoke device, a law enforcement official said. The official was not authorised to discuss the investigation publicly and spoke on condition of anonymity.

Authorities undertook a search of Long’s home in Newbury Park, about 8 kilometres from the Borderline bar, for clues to what set him off, but they have yet to find anything.

Grieving people are led into the Thousand Oaks Teen Center where families have gathered after the deadly shooting. Source: AP Photo/Richard Vogel

Shooter was a former Marine who served in Afghanistan

Long was in the Marines from 2008 to 2013, rose to the rank of corporal and served in Afghanistan in 2010-11, the military said.

Authorities said he had no criminal record, but Sheriff Dean said officers were called to his home in April, when deputies found him angry and acting irrationally. The sheriff said officers were told he might have PTSD because of his military service. A mental health specialist met with him and didn’t feel he needed to be hospitalised.

Tom Hanson, 70, who lives next door to Long and his mother, said Wednesday that he called the police about six months ago when he heard “heavy-duty banging” and shouting coming from the Longs’ home.

“I was concerned because I knew he had been in the military,” he said.

Hanson said the sheriff’s deputy who arrived took his information, but he never learned more about what happened and hadn’t spoken to Long since then. He said he was “dumbfounded” by the bloodshed.

Officers around a police SUV in the vicinity of a shooting in Thousand Oaks, California, early Thursday morning local time. Source: AP

Thousand Oaks community distraught over shooting tragedy

Anxious family members gathered at a teen centre in town to await word on the fate of loved ones who had gone to the club.

Jason Coffman received confirmation that his son Cody, 22, who was about to join the Army, was dead. Coffman broke down as he told reporters how his last words to his son were not to drink and drive and that he loved him.

“Oh, Cody, I love you, son,” Mr Coffman sobbed.

People comfort each other as they stand near the scene in Thousand Oaks, California, where a gunman opened fire. Source: AP Photo/Mark J. Terrill

The bloodshed was the latest in what seems to be a never-ending string of mass shootings that are happening with terrifying frequency across the United States.

President Donald Trump praised police for their “great bravery” in the California attack and said, “God bless all of the victims and families of the victims.” He ordered flags flown at half-staff in honor of the victims.

College night bar shooting ‘an attack on our community’

The Borderline, which includes a large dance hall along with several smaller areas for eating and drinking, was holding its regular “College Country Nights” when the attack took place.

Nick Steinwender, Cal Lutheran student body president, told KTLA-TV he immediately started receiving messages about the shooting, and he and his roommate went to the scene to offer rides back to campus or moral support.

“It’s going to be a very somber day,” Mr Steinwender said.

“I know we don’t have all the details in yet, but you know, it just feels like it’s an attack on our community. You know, I think it’s going to be something that we’re going to have to come together and move past.”