A California teenager was identified by police on Monday as the gunman who killed three people, including two children, at a food festival south of San Francisco. Santino William Legan, 19, cut through a fence at the festival on Sunday evening and shot at people with a "AK-47-style" assault rifle at the Gilroy Garlic Festival, Gilroy Police Chief Scot Smithee told reporters. Within a minute of opening fire, Legan was fatally shot by three onsite police officers armed with handguns. "It could have gone so much worse so fast," Smithee said, noting the festival, which takes place about 30 miles (48 km) southeast of Silicon Valley, America's tech hub, welcomes thousands of visitors. Police were still trying to determine the motive. They were also investigating unconfirmed reports by eyewitnesses that Legan may have had an accomplice. Legan killed a 6-year-old boy, a 13-year-old girl and a man in his 20s, Smithee said. Police believe Legan purchased the rifle legally in Nevada on July 9, Smithee said. Fifteen people were injured, but it was unclear how many were shot or otherwise hurt in the crush of bystanders trying to flee, according to police. One person was in critical condition, a hospital spokeswoman said. President Donald Trump described the gunman as a "wicked murderer" and asked people to pray for the victims during an event at the White House. "We grieve for their families, and we ask that God will comfort them with his overflowing mercy and grace," he said. The gunman cut through a fence to evade metal detectors and other security at the festival entrance, police said. Legan appeared to post a photograph from the festival on his Instagram account shortly before the shooting accompanied by disgruntled captions. The account only appeared to be a few days old, and was deactivated at some point on Monday morning. "Ayyy garlic festival time," he wrote in the caption to the picture of people walking through the festival grounds. "Come get wasted on overpriced shit." Another photograph posted on Sunday showed a sign warning of a high danger of forest fires. Its caption urged people to read "Might is Right," a racist and sexist treatise written by the pseudonymous author Ragnar Redbeard in the late 19th century. "Why overcrowd towns and pave more open space to make room for hordes of mestizos and Silicon Valley white twats?" the caption continued. Footage uploaded to social media showed festival attendees scattering in fear and confusion as loud popping sounds could be heard in the background. "What's going on?" a woman can be heard asking on one video. "Who'd shoot up a garlic festival?" Police declined to identify the victims on Monday, but one of them was identified by his grandmother as Stephen Romero in an interview with a local ABC affiliate. Maribel Romero described Stephen as a "loving boy" who was "always kind, happy and ... playful." Romero was near a bouncy house when he was shot, the San Jose Mercury News reported. "He was joyful, always wanted to play, always positive," his father told the San Jose newspaper during an interview at the hospital where the boy died. His mother and the boy's other grandmother were also shot and were being treated in a hospital, Maribel Romero told local media. Founded in 1979, the Gilroy Garlic Festival is an annual event run by volunteers and held outdoors at Christmas Hill Park. Weapons of any kind are prohibited, according to the event's website, which also said anyone wearing clothing or paraphernalia indicating membership in a gang, including a motorcycle club, would be refused entry. — Reuters