Ian David Long burst into the bar in Thousand Oaks on Wednesday night and shot his victims with a handgun, seemingly at random, as they tried to escape.
His motive is still unclear and the ex-marine and Afghanistan veteran is believed to have killed himself as police moved in.
The official, speaking anonymously to Associated Press, said Long had posted on social media about whether people would believe he was sane - but would not give any more details on what he wrote.
Investigators are also looking at whether he believed his ex-girlfriend would be at the bar, the official said.
President Donald Trump described the 28-year-old as "a very sick puppy" with "a lot of problems" amid claims he may have been suffering from PTSD (post-traumatic stress disorder).
Neighbours said they had heard frequent loud fights with his mother and that police were called out in April - though on that occasion mental health experts decided intervention was not needed.
The latest massacre has left many family members of the dead exasperated at the seeming inability to tighten US gun laws.
One of the victims survived last year's massacre at a concert in Las Vegas - the worst in modern American history.
The mother of Telemachus Orfanos, 27, told reporters: "I don't want prayers. I don't want thoughts. I want those b******* in Congress - they need to pass gun control so no one else has a child that doesn't come home."
Long used an illegal extended magazine - designed to hold extra bullets - in his attack on the Borderline Bar & Grill, about 40 miles west of Los Angeles.
The venue was packed with students who described him wearing a ski mask or hood as he shot people scrambling for cover and trying to escape through windows. He also used a smoke bomb, said an official.
A police officer has been hailed as a hero after he ran into the bar to stop the massacre.
Fellow officers from the Ventura County Sheriff's Office described 54-year-old Sergeant Helus - who died from his injuries in hospital - as an "exceptional friend and man".
"The fact that he was the first in the door doesn't surprise me at all," said Sergeant Eric Buschow.
"He's just one of those guys that wouldn't hesitate in a situation."
More than 50,000 people have signed Sky News' petition backing televised leaders' debates for elections - have you?
Among the other victims were Cody Coffman, 22, who had been planning to join the military and was looking forward to the arrival of a baby sister later this month.
His father, Jason Coffman, said: "I talked to him last night, before he headed out the door. First thing I said was, 'please don't drink and drive'. Last thing I said was, 'son, I love you'. That was the last thing I said."
More from California
Fleeing California wildfires: Flames race towards city reeling from mass shooting
At least five people killed in their cars as California wildfires spread and Malibu is evacuated
Thousand Oaks shooting: The victims of California bar attack
Thousand Oaks residents know latest mass shooting unlikely to change US gun laws
Thousand Oaks shooting: Gunman who killed 12 at bar was ex-marine and Afghanistan veteran
US midterms: How California could prove key for the Democratic Party
Justin Meek, 23, was also killed.
California Lutheran University President Chris Kimball confirmed in a statement that he was among the dead, adding that he had "heroically saved lives in the incident".