A US gunman was stopped from going on a Sandy Hook-like massacre of school children on Tuesday after staff at the California school quickly put the building into lockdown.
Local police say the man opened fire "without provocation" in a tiny, rural town, killing four people and wounding at least 10 others, including a student, before police shot him dead.
The Sacramento Bee newspaper, citing multiple law enforcement officials, later identified the suspect as 43-year-old Kevin Janson Neal.
The rampage began shortly before 8am local time when the gunman fatally shot a neighbour he had been accused of stabbing in January, Tehama County Assistant Sheriff Phil Johnston said.
Shortly afterward, the gunman rammed through the gate of Rancho Tehama Elementary School about two miles away and spent about six minutes shooting into the building, striking at least one student, Johnston said.
Surveillance video showed the gunman, who was not identified, trying unsuccessfully to enter the school.
School officials' swift decision to lock the doors after hearing gunfire was "monumental" in saving the lives of countless children, Johnston said. No one was killed there.
The gunman left the school after he could not get inside and purposely crashed the stolen truck he was driving into another vehicle and shot at its occupants.
The shooter stole the car of a person who stopped to check on the crash and ran away when confronted with a gun.
He continued the rampage until police shot him about 45 minutes after it started, Johnston said.
"This man was very, very bent on completing what he set out to do," the assistant sheriff said.
Police offered no immediate word on the assailant's motive, but a sheriff's official said the shooter's neighbours reported a domestic violence incident a day earlier.
A man named Brian Flint told the Record Searchlight newspaper in the city of Redding that his neighbour was the gunman and that his roommate was among the victims.
Witnesses reported hearing gunshots and children screaming at the school, which has one class of students from kindergarten through fifth grade.
Johnston said authorities believe they know the identity of the shooter but declined to release his name pending further investigation.
He appears to have fired a semiautomatic rifle and two handguns at seven locations.