A California man killed his wife and hid her body in their home before he fatally shot four people during a gun rampage, police say.
"We believe that's probably what started this whole event," Tehama County Assistant Sheriff Phil Johnston told reporters on Wednesday.
Kevin Janson Neal, 43, fired into an elementary school in Rancho Tehama, but was stopped from entering by teachers.
His wife's body was found hidden under floorboards, police say.
Investigators said they believe Neal shot and killed his wife on Monday night, sparking the gun rampage early on Tuesday.
Mr Johnston said police also found two neighbours shot dead. The victims were involved in an ongoing dispute with Neal that lead to an assault with a deadly weapon charge against him last January, authorities said.
He killed two others who police said appeared to have been shot at random.
A motive for the attack is still unclear, but Mr Johnston said he thought Neal "had a desire to kill as many people as he could".
At one point Neal crashed a stolen vehicle through the Rancho Tehama Reserve School's locked gate before class began, firing dozens of shots through windows and walls when he was unable to enter the building.
Mr Johnston praised teachers for issuing a lockdown and securing the school after hearing gunshots, adding that their actions prevented a "horrific bloodbath".
Police said 14 people were injured in total, including seven children.
One child at the school was shot in the chest while other children were mainly hurt by broken glass, Mr Johnston said.
The family of Alejandro Hernandez, 6, created a GoFundMe account to help raise money for his healthcare costs after he was shot in the chest and foot.
Police said two semi-automatic rifles used by the gunman were recovered from one of the crime scenes.
Mr Johnston said the guns were obtained "in an illegal manner" and manufactured illegally.
According to court documents, a restraining order taken out against him following an incident with his neighbours in January would have required him to forfeit any firearms.
During the attack, Neal also wore a military-style assault vest capable of storing multiple rounds of ammunition.
"I'm on a cliff and there's nowhere to go"
Police said he was out on bail after he posted a $160,000 bond for an assault with a deadly weapon charge, which stemmed from an incident with his neighbours.
A woman, who identified herself as Neal's mother, told the Associated Press news agency that Neal called her before the attack and said: "I'm on a cliff and there's nowhere to go."
Neal was in a long-running dispute with neighbours who he believed were cooking methamphetamine, she said.
She said Neal, who was raised in North Carolina, had been working as a cannabis farmer and had recently married his long-time girlfriend.
His sister, Sheridan Orr, told the AP that she believed her brother was addicted to drugs and struggled with mental illness and a violent temper.
"We're stunned and we're appalled that this is a person who has no business with firearms, whatsoever," Ms Orr said.