The former marine who gunned down 12 people at a bar in southern California died from a self-inflicted gunshot, an autopsy has found.

Ian Long killed 11 civilians at the Borderline Bar and Grill in Thousand Oaks, along with a police officer. More than 20 people were injured.

Police said the officer exchanged gunfire with the 28-year-old, who was found dead at the scene.

But Ventura County sheriff Bill Ayub said an autopsy found that Long took his own life.

Investigators say that based on timestamps, he posted on Instagram during the attack. He discussed his mental state and asked whether people would believe he was sane.

They have not commented on a motive for the attack or whether mental illness played a role.

But neighbours reported hearing frequent fights between Long and his mother in the home they shared. One was so extreme that police were called to the house in April last year.

Thousand Oaks shooting: in pictures Show all 10 1 /10 Thousand Oaks shooting: in pictures Thousand Oaks shooting: in pictures Emergency services attend the scene AP Thousand Oaks shooting: in pictures People walk away from the scene EPA Thousand Oaks shooting: in pictures Emergency service vehicles flood the scene Reuters Thousand Oaks shooting: in pictures Police officers secure the road EPA Thousand Oaks shooting: in pictures Police block an intersection by the scene of the shooting AP Thousand Oaks shooting: in pictures A woman hugs with her father at the scene EPA Thousand Oaks shooting: in pictures Survivors are interviewed at the scene EPA Thousand Oaks shooting: in pictures Police officers interview people at the scene AFP/Getty Thousand Oaks shooting: in pictures People wait near the scene of the shooting AP Thousand Oaks shooting: in pictures People walk away from the scene of the shooting AP

At the time police worried that Long might be suffering from post-traumatic stress disorder after serving in the army in Afghanistan. A mental health specialist assessed Long but found no grounds to hospitalise him.

Another possible motive being considered is whether Long believed a former girlfriend might have been at the bar on a night that attracts students from several colleges nearby.

Sheriff’s captain Garo Kuredjian said that investigators were still interviewing witnesses, after serving a search warrant at Long’s home and searching the car he drove to the bar.

“We’re going to exhaust every investigative means possible,” Mr Kuredjian told the Ventura County Star. He added that there is no timeline for completing the investigation and the analysis of items obtained in the searches could take months.

Long grew up in Thousand Oaks and several people who knew him said he frequently made others feel uncomfortable.

Dominique Colell, who coached girls’ track and field at the high school where Long was a sprinter, said that he could be verbally and physically violent.

Support free-thinking journalism and attend Independent events

Ms Colell said that Long once used his fingers to mimic shooting her in the back of the head as she talked to another athlete. On another occasion, he grabbed her after she refused to return a mobile phone he said was his.

“I literally feared for myself around him,” Ms Colell said. “He was the only athlete that I was scared of.”