(CNN) -- A 6-year-old boy, a 13-year-old girl and a man in his 20s were killed when a gunman opened fire with an assault-type rifle at the Gilroy Garlic Festival in northern California, Gilroy Police Chief Scot Smithee said.
The weapon, an AK-47-style rifle, was purchased legally by the gunman in Nevada on July 9, Smithee told reporters at a news conference Monday.
The shooter -- identified as Santino William Legan, 19 -- also injured at least 12 others before he was fatally shot on Sunday night by three officers who responded within a minute of the gunfire beginning, Smithee said. Of the injured, seven people remain in hospitals.
Legan apparently entered the annual festival, which attracts about 100,000 people every year, by cutting through a back fence and then began shooting at random, the chief said. Smithee credited a heavy police presence for saving lives as chaos descended on the decades-old festival in Gilroy, a city about 30 miles south of San Jose.
"I think it's very, very fortunate that they were able to engage him as quickly as they did," he said.
Authorities earlier said they were searching for a second person who witnesses said may have been involved in the shooting. But on Monday, Smithee said multiple people had given differing versions of this person, "so we really don't know at this point."
Also, the FBI searched a Walker Lake, Nevada, residence believed to have been used by the gunman prior to the shooting, according to Mineral County District Attorney Sean Rowe.
The assault-style rifle used in the attack cannot be legally sold in California, nor can it be brought into the state legally, Attorney General Xavier Becerra said.
The killings were the latest addition to a bloody list of American mass shootings that have targeted people anywhere and everywhere they congregate: at festivals, schools, places of worship, movie theaters, workplacesand bars.
Instagram posts before shooting
An Instagram account bearing the shooter's name, created four days ago, posted two messages shortly before the attacks, including a reference to a white supremacist text.
One post was a photo of people walking around the Garlic Festival with the words "Ayyy garlic festival time Come get wasted on overpriced sh**." The other post, made about an hour later, showed a sign of Smokey Bear saying "Fire Danger High Today."
"Read Might is Right by Ragnar Redbeard," the caption said. "Why overcrowd towns and pave more open space to make room for hordes of mestizos and Silicon Valley white tw**s?"
A "mestizo" is a person of mixed descent, usually white and Hispanic, or white and American Indian. "Might is Right" is a book published in the late 1800s which has been described as a white supremacist text that promotes anarchy, vilifies Christianity and calls Jesus the "true Prince of Evil." The natural order, according to the book, is a world at war in which the strong must vanquish the weak, and white men must rule over those of color.
Josh Carman told CNN he knew Legan from high school, but didn't know him well. When he was a senior at Gilroy High School, Legan was a sophomore.
"I never had any classes with him or anything, so we never really got acquainted, I just have definitely seen him around school," he said. "He wasn't the type of person that everyone knew, but he didn't stand out as being too abnormal," he said.
Tanner Eastus, another Gilroy High School student, told CNN that "[Legan] seemed like a normal guy. I don't believe anyone expected anyone to do something like this, especially in Gilroy."
They thought the pops were fireworks
Over the course of the three-day festival, families sampled garlicky foods like pasta con pesto and garlic-laced calamari and scampi, kids posed with festival mascot "Herbie" and a series of musicians performed, including Colbie Caillat and her band, Gone West.
The pop-pop-pop of gunfire began just after 5:40 p.m. Sunday as the rock band TinMan played its last song.
"We ran off the stage (and) we crawled underneath it," TinMan singer Christian Swain said. "We could smell the gunpowder."
Videos of the aftermath show crowds of people screaming and fleeing as they sought safety. Lex De La Herran was walking away as the music on stage had begun winding down, he said.
"I turned around for a quick moment and I hear the gunshot sounds," he said. "At first I thought it was fireworks but a man behind me screamed that 'those are real, those are real.'"
"I just froze like a deer in the headlights," he said.
De La Herran said a piece of shrapnel hit him in the head. Then, he started running among the crowds.
"I saw people jumping over the fence, people trampling over each other, it was just widespread chaos," he said. "People were definitely in shock ... some people were visibly shaking."
Cynthia Saldivar also said she initially thought the sounds were fireworks.
"We looked toward the area that it was coming from and everyone stood still for a second and realized it was gunshots," she told CNN. "Everyone started running out towards us up the hill to the street to be safe. Then I saw some people shot, some doing CPR on others."
It felt like a nightmare, Miquita Price said.
The shooter stood about 15 feet away from her and was blocking her only possible escape route, she told CNN.
"I started running, we hit the ground and I literally laid down on the ground," she said. The shooter stopped firing for a couple of seconds, multiple people reported, and when he began to shoot again, Price said she took off running.
The woman running next to her was hit and Price said she continued until she found a truck to hide behind. She's still in shock.
"(There) was blood everywhere," she said. "I read about this but I never thought I would be in it."
Stephen Romero, 6, was killed during the shooting, Gilroy City Council member Fred M. Tovar told CNN.
Tovar said he was "deeply saddened by the news."
"I pray that God will grant his family strength. My most sincere condolences. I will keep your family close in my thoughts and prayers in the coming weeks as you are going through the process of grieving," he said in a statement.
Stephen's grandmother spoke to CNN affiliate KRON about the boy's death.
"This is really hard, there's no words to describe (it)," Romero's grandmother told the affiliate. "He was such a happy kid, I don't think that this is fair."
Stephen's father, Alberto Romero, told CNN affiliate the San Jose Mercury News newspaper that he was at home when his wife called to say that she, her mother and their son had been shot.
"I couldn't believe what was happening, (I thought) that what she was saying was a lie, maybe I was dreaming," he said.
The dad went to a hospital to see his son.
"They told me he was in critical condition and that they were working on him," he said. "Five minutes later they told me he was dead."
The teenage victim is 13-year-old Keyla Salazar of San Jose, according to the Santa Clara County Office of the Medical Examiner-Coroner.
Keuka College in upstate New York identified the third victim as Trevor Irby, 2017 graduate.
Irby was a biology major, school president Amy Storey said in a statement.
"We are shocked that this latest episode of senseless gun violence resulted in the loss of one of our recent graduates—graduates in whom we place so much hope because of their potential to create a brighter tomorrow," Storey said.
The college said Sarah Warner, an alumna, was with Irby at the festival when the shooting took place but was not injured.
Officers confronted shooter in minutes
Swain said police seemed to secure the area within five minutes from when the shooter began firing.
"We know the event was well-covered with security and we'd seen them as we came in to set up and play," he told CNN. "At least in my head, I knew they would be there and sure enough that seems to be what happened."
Chief Smithee said it appeared that the shooter entered the festival via a creek that borders a parking area. The shooter used a tool to cut through a fence and get into the area undetected.
Police recovered a firearm and rifle ammunition from the shooting scene, a law enforcement source told CNN.
The multi-day festival attracts about 100,000 people annually to Gilroy, the self-proclaimed garlic capital of the world, according to attendance records. There's food, live music, cooking competitions and thousands of community volunteers who bring it all together.
The event has raised more than $11.7 million for local charities since 1979, organizers said. In 2018, organizers donated more than $255,000 to 170 different groups, including churches and school sports teams.
This year -- the festival's 41st -- featured celebrity chefs Tom Colicchio of "Top Chef" and Gerron Hurt of "MasterChef."
"To have seen this event end this way this day is just one of the most tragic and sad things that I've ever had to see," Gilroy Garlic Festival Executive Director Brian Bowe said.
Gilroy, a city of about 59,000 people, is a "tightly-knit," family-like community, Bowe said.
"And for over four decades that festival has been our annual family reunion," he said Sunday.
Shawn Keck, president of the 2019 Gilroy Garlic Festival, thanked the police and first responders who came to their aid.
"We are heartbroken that senseless violence brought this year's festival to such a terrible and tragic end," he said in a statement.