Two adults and a child have been killed in a shooting in a classroom of a primary school in San Bernardino, California, police say.
The suspect shot and killed his estranged wife, a teacher, and wounded two children who were behind her, one of whom died of his wounds.
He then turned the gun on himself, police said.
Police chief Jarrod Burguan described the incident as a suspected "murder-suicide" attempt.
The shooting happened at 10:30 local time (17:30 GMT) at North Park Elementary School in San Bernardino county, 60 miles (96km) east of Los Angeles.
The gunman, named as 53-year-old Cedric Anderson, had gained entry to the school as a visitor and kept his weapon concealed until he opened fire in the classroom where 15 children with special needs were being taught, authorities said.
He killed his wife Karen Elaine Smith and fatally wounded eight-year-old Jonathan Martinez, who was airlifted to hospital but later died.
A nine-year-old pupil remains in hospital in a stable condition, the Los Angeles Times reported.
Mr Burguan tweeted shortly after the incident that the suspect was "down" and there was "no further threat". The school was immediately evacuated.
Up to 600 students were transferred by bus to nearby Cajon High School, where they were later met by their parents.
"Police operations are continuing to secure the area," Mr Burguan said earlier on Twitter, adding: "However, we do believe the threat is down."
In December 2015, 14 people were killed and 21 others wounded when a couple entered a disabled service centre in San Bernardino and began firing at a group of county health workers.