Police say the former Marine shot into a crowd at a Thousand Oaks bar, killing 12 before likely turning gun on himself.

Police identified 28-year-old Ian David Long as the suspected gunman in a shooting at a bar in southern California that left at least 12 people dead late on Wednesday.

Police said Long appeared to have shot randomly into the crowd at the Borderline Bar and Grill in Thousand Oaks, about 50km west of Los Angeles. The bar was hosting a college country music night and was packed with students and other patrons.

Ventura County Sheriff Geoff Dean said on Thursday that Long was armed with a Glock 21, a .45-caliber handgun designed to hold 10 rounds plus one in the chamber. But Dean said the gun had an extended magazine that is illegal in California.

The sheriff said Long is believed to have killed himself after opening fire on the crowd.

Among the dead is Sergeant Ron Helus, who was reportedly killed while trying to enter the club with Highway Patrol officers responding to the gunfire. The others killed have not been identified.

At least one person was being treated for a gunshot wound, while more than a dozen others suffered minor injuries after jumping out of windows and diving under tables during the attack.

Previous contact with police

Dean said his department had several previous contacts with Long, a former US Marine, including a call to his home in April, when deputies found him acting irate and irrationally.

{articleGUID}

The sheriff said a mental health crisis team was called at that time and concluded that Long did not need to be taken into custody.

Dean said the other prior encounters were a traffic accident and an incident when he was the victim of battery at a bar.

The shooting is the latest in a long list of mass shootings in the US.

Three of the deadliest mass shootings in US modern history have occurred since October 2017.

In February, a gunman killed 17 people – most of whom were students – at a high school in Florida. In November 2017, a man entered a church in rural Texas and killed 26 people. And in October 2017, a man shot hundreds of people attending a country music concert in Las Vegas from the window of a hotel, killing 58 people and injuring more than 500 others.

The string of shootings has reignited the debate over gun control, with young people taking the lead. Earlier this year, hundreds of students, teachers and their supporters marched in large cities in the US against gun violence and called on politicians to take more action on gun control.