A six-year-old boy and a 13-year-old girl are among the three people killed in a shooting at a food festival in California, police have confirmed.
Fifteen were injured when the suspect, named by police as Santino William Legan, 19, opened fire at the Gilroy Garlic Festival on Sunday evening (local time).
Police say the suspect used an assault rifle that he purchased legally in neighbouring Nevada this month.
The gunman was shot dead by police, who are looking into a possible accomplice.
Six-year-old Stephen Romero is the first of the dead to be identified by local media. His mother and grandmother were wounded.
Police confirmed a man in his 20s was also killed. None of the victims have been officially named.
At least 15 people were transported to hospital, according to officials from the four hospitals where victims were brought. At least 12 were treated for gunshot wounds, according to health officials.
Gilroy police chief Scott Smithee said during a news conference that the officers who were deployed at the event were able to respond within a minute.
He said three officers engaged the suspect and, although they were "outgunned with their handguns against a rifle", they managed to fatally wound him quickly and end the shooting.
"I can't tell you how proud I am at the officers for being able to engage this guy as quickly as they did because we had thousands of people there in a very small area, and you know it could've gotten so much worse so fast," Mr Smithee said.
"It seems like this was a random act," said Chief Smithee, with his voice cracking with emotion.
When asked about reports of a possible accomplice and whether that was true, he responded: "We just don't know."
FBI Agent in Charge Craig Fair told reporters that the priority for investigators was to try to determine motivation, ideological leaning and whether the attacker was affiliated with any group.
He said it would take time for the "expansive" crime scene to be investigated.
Legan's home in Gilroy - only about one mile from the shooting scene - was being searched late on Sunday and into Monday morning.
It remains unclear whether he was targeting people individually or firing at random.
The lead guitarist of the group TinMan, which was performing on stage when the attack began, said he heard someone ask the shooter: "Why are you doing this?"
Jack Vanbreen told the Associated Press he heard the assailant respond: "Because I'm really angry".
Police said the attacker had cut through a fence surrounding the event, which takes place 30 miles (48km) south of San Jose and attracts 100,000 people each year.
Alberto Romero, the father of six-year-old victim Stephen Romero, told Mercury News that he was at home with his nine-year-old daughter when he got the panicked call from his wife.
They had been playing in an inflatable bounce house at the time of the attack, she told him, when the boy was shot in the back.
"I couldn't believe what was happening, that what she was saying was a lie, that maybe I was dreaming," said Mr Romero.
"He was joyful, always wanted to play, always positive," he said, adding that the boy's mother has been placed in a medically induced coma after being shot in the stomach and her mother was being treated for a gunshot wound in the leg.
It was the 246th mass shooting in the US this year, according to US tracking website Gun Violence Archive.
At the White House on Monday, US President Donald Trump thanked the police "who swiftly killed the shooter".
He called the attacker "a wicked murderer" and vowed that the US would grieve for the families of victims and "ask that God comfort them".