GILROY, Calif. -- Only a few days ago, Gilroy was known for one thing: garlic. The rural community near San Francisco lived and breathed the prized, pungent crop.

Now it's the site of the latest American mass shooting.

On Sunday evening, a 19-year-old gunman with apparent white supremacist views slipped into the annual Gilroy Garlic Festival and unloaded a military-style rifle before police shot him to death.

On Monday night, hundreds of residents held a candlelight vigil to mourn a 6-year-old boy, a 13-year-old girl and a New York college graduate who were slain . Twelve others were injured.

As they raised votive candles, long tapers or tea lights, they also raised their spirits in the defiant cry of "Gilroy Strong."

A sign reading the same underneath an American flag covered in two garlic cloves hung from the front of the stage.

"We cannot let the bastard that did this tear us down," Mayor Roland Velasco declared to cheers.

It was the cry heard so often after shootings at schools, parks, movies, nightclubs and festivals around the country.

From Washington, President Donald Trump condemned the "wicked murderer."

The shooting brought out renewed demands for national gun control by politicians in California, which already has some of the strictest firearms laws in the nation. Gov. Gavin Newsom called for controls on high-powered, high-capacity guns he labeled "weapons of mass destruction."

"Today, I met with a 12-year-old who was shot while in a bounce house. A grandmother mourning the loss of her 6-year-old grandson," Newsom tweeted. "This is America today -- the shootings continue. Loved ones are buried. Children are gunned down. And Congress does nothing."

"It keeps happening, over and over and over again, on their damn watch," Newsom told reporters. "I can't put borders up in a neighbouring state where you can buy this damn stuff legally."

The shooter, Santino William Legan, legally purchased the semi-automatic military-style rifle this month in Nevada, where his last address is listed. Under a California law that went into effect Jan. 1, residents younger than 21 are barred from firearms purchases unless they are in the military or law enforcement. The minimum purchase age is 18 in Nevada, where firearms laws are less restrictive.

While authorities sought a motive for the killings, he had posted white supremacist views. He urged his Instagram followers to read a 19th century book popular with white supremacists on extremist websites. It appeared with a photo of Smokey the Bear in front of a "fire danger" sign. Legan also complained about overcrowding towns and paving open space to make room for "hordes" of Latinos and Silicon Valley whites.

In his last Instagram post Sunday, Legan sent a photo from the Gilroy Garlic Festival minutes before opening fire.

Under it, he wrote: "Ayyy garlic festival time" and "Come get wasted on overpriced" items. Legan's since-deleted Instagram account says he is Italian and Iranian.

The postings are among the first details that have emerged about Legan since authorities say he appeared to fire at random, sending people running and diving under tables. Police patrolling the event responded within a minute and killed Legan as he turned the weapon on them.

Legan grew up less than a mile from the park where the city known as the "Garlic Capital of the World" has held its three-day festival for four decades, attracting more than 100,000 people with music, food booths and cooking classes.

Police searched Legan's vehicle and the two-story Legan family home, leaving with paper bags. Authorities also searched an apartment they believed Legan used this month in remote northern Nevada. Officials didn't say what they found.

Big Mikes Gun and Ammo, which appears to be a home-based internet gun shop in Fallon, Nevada, said on its Facebook page that Legan ordered the rifle off its website and "was acting happy and showed no reasons for concern" when the store owner met him. The post said it was "heartbroken this could ever happen."

The shooting followed a series of mass killings in California, including an attack at a Thousand Oaks bar in November where 12 people died and a 2015 terrorist attack in San Bernardino where 14 were killed. The nation's worst modern mass shooting remains a 2017 attack at a country music concert in Las Vegas where a gunman killed 58 and injured hundreds.

In California, police had training in how to respond to an active shooter. While they prepared for the worst, they never expected to use those skills in Gilroy, a city of about 50,000 roughly 80 miles (176 kilometres) southeast of San Francisco.

The city had security in place for one of the largest food fairs in the U.S. It required people to pass through metal detectors and have their bags searched. Police, paramedics and firefighters were stationed throughout the festival.

But Legan didn't go through the front entrance. He cut through a fence bordering a parking lot next to a creek, Gilroy Police Chief Scot Smithee said. Some witnesses reported a second suspect, and authorities were trying to determine if he had any help.

The gunfire sent people in sunhats and flip-flops running away screaming. Some dove for cover under the decorated food booth tables. Others crawled under a concert stage, where a band had started playing its last song.

Candice Marquez, 51, a honey vendor at the festival, said she was just 10 feet (3 metres) from the shooter and saw him replace a clip of ammunition.

"He was super quiet, he was reloading, and we ran," she told the San Francisco Chronicle.

The youngest victim, Stephen Romero, described by his grandmother as a kind, happy and playful kid, had just celebrated his 6th birthday in June at Legoland in Southern California.

"My son had his whole life to live and he was only 6," his father, Alberto Romero, told San Francisco Bay Area news station KNTV after the shooting.

Also killed was 13-year-old Keyla Salazar from San Jose. The teen was eating ice cream with family members when they heard gunshots and began to flee, said her aunt, Katiuska Vargas.

The teen stayed back to keep pace with a relative who uses a cane and was shot with a bullet that otherwise might have hit that woman, Vargas said.

Vargas says Keyla's stepfather was wounded as he went back for her.

Keyla loved animals and was planning on getting a puppy for one of her two younger sisters, Vargas said.

"She was such a caring person," Vargas said. "She would give everything to other people ... We lost a really beautiful life."

The oldest victim killed was Trevor Irby, 25, a biology major who graduated in 2017 from Keuka College in upstate New York.

Troy Towner said his sister, Wendy Towner, was at the festival for her business, the Honey Ladies, when she saw a man with a gun climb over the fence. She yelled at him: "No, you can't do that!"

The gunman shot her in the leg and her husband three times, while a young girl dragged their 3-year-old son under a table, Towner wrote on a fundraising page he set up for his sister.

Legan then approached the couple as they lay motionless on the ground and asked if they were all right. They didn't move, fearing he would finish them off, Towner wrote.

Towner said his sister underwent surgery and was expected to have long-term nerve damage, while her husband faces many surgeries.

Candice Marquez, who works for Wendy Towner and her husband, Francisco, told The Associated Press that she had stepped away to go to the bathroom and saw the gunman heading to their tent. She said her 10-year-old niece helped the toddler to safety.

"She was brave," Marquez said.

Jan Dickson, a neighbour who lives across the street from the Legan family, described them as "a nice, normal family." She said Santino Legan had not lived there for at least a year.

"How do you cope with this? They have to deal with the fact that their son did this terrible thing and that he died," Dickson said.

------

This story clarifies the wording about the California firearms law.

------

Watson reported from San Diego. Associated Press reporter Mike Balsamo in Washington, Natalie Rice in Los Angeles, Scott Sonner in Hawthorne, Nevada, Ken Ritter in Las Vegas, and Martha Mendoza in Gilroy contributed to this report