This screenshot of Santino William Legan's Instagram account shows a selfie of Legan, who opened fire with an

GILROY, Calif. (AP) — The 19-year-old gunman who opened fire at a Northern California food festival was "kind of a loner" and much of his life was shrouded in mystery, an FBI official said as investigators searched for a motive.

Police believe Santino William Legan fired randomly Sunday, killing three people, after cutting through a fence to get into the Gilroy Garlic Festival. Officers patrolling the popular event responded within a minute and killed him.

Legan attended high school in Gilroy in his senior year and was recently living in Nevada, where he purchased two guns — the AK-47-style semi-automatic rifle he used in the attack and a shotgun that was found in his car near the festival, authorities said.

A bag of ammunition was found along a creek near the fence, police revealed Tuesday.

"We understand him to be kind of a loner," said Craig Fair, deputy special agent in charge of the FBI's San Francisco Division. "People who act alone are exceptionally dangerous because they ... may not communicate their plans, intentions, mindset — they may not impart that on other people."

Legan was living in an apartment in Walker Lake, a remote northern Nevada community, and had not had any run-ins with the law since moving there in the spring, Mineral County Sheriff Randy Adams said.

Officials searched the apartment, seizing empty shotgun and rifle boxes, a gas mask, empty ammunition boxes, pamphlets on guns and a sack full of ammunition casings, according to Nevada court records. There were a number of electronics, including three hard drives and thumb drives, as well as a letter "from Virginia to Santino."

The FBI said they were looking through Legan's social media, emails and phone to find out who he was talking to and what he was expressing and thinking. Authorities don't believe he was targeting anyone based on any specific characteristics like race, but they're still trying to determine his ideology, Fair said.

On the day of the attack, Legan urged his Instagram followers to read a 19th-century book popular with white supremacists on extremist websites. He also complained about overcrowding towns and paving open space to make room for "hordes" of Latinos and Silicon Valley whites.

Legan posted a photo from the festival minutes before opening fire, saying, "Come get wasted on overpriced" items. His since-deleted Instagram account says he is Italian and Iranian.

While some killers in recent mass shootings have taken to posting writing or even broadcasting their attacks, there are cases where shooters leave very little public footprint and no motive is uncovered.

That includes the gunman who carried out the deadliest mass shooting in modern U.S. history. No clear motive was found for why Stephen Paddock killed 58 people at an outdoor music festival in Las Vegas in 2017, though the FBI said he sought notoriety.

Gilroy Police Chief Scot Smithee told reporters that authorities believe Legan acted alone but are still investigating. Investigators tracked Legan's movements around town before the shooting, and video shows him always alone when stopping at various stores, Smithee said.

People had to pass through metal detectors and have their bags searched at the long-running festival that draws more than 100,000 people with music, food booths and cooking classes to the city roughly 80 miles (129 kilometers) southeast of San Francisco.

Police, paramedics and firefighters were stationed throughout the event, along with FBI agents who, in a common practice, had been asked to keep an eye on the event, authorities said.

Legan bypassed those security measures by cutting through the fence.

He killed 6-year-old Stephen Romero and 13-year-old Keyla Salazar of San Jose, along with Trevor Irby, 25, of Romulus, New York, who was at the event with his girlfriend. She wasn't hurt.

A dozen other people were injured. About half have been released from hospitals.

___

Associated Press reporter Stefanie Dazio in Los Angeles contributed to this report.

Police tape stretches behind a perimeter fence at the Gilroy Garlic Festival the morning after a deadly shooting at the food festival in Gilroy, Calif., Monday, July 29, 2019. Experts say organizers should take another look at their emergency plans in the wake of the shooting at the festival to see if they can make additional safety improvements. (AP Photo/Noah Berger)
This photo taken Monday, July 29, 2019, shows a triplex with shingles stacked on top on Cliff House Road behind the sign for a nearby resort along the shore of Walker Lake about 10 miles north of Hawthorne, Nev., that authorities searched in connection with an investigation into the shooting the day before at a festival in Gilroy, Calif. Santino Legan was believed to have lived in the middle unit of the three-unit triplex before the shooting. (AP Photo/Scott Sonner)
Investigators examine an area by an inflatable slide at Christmas Hill Park, the scene of Sunday's deadly shooting, Monday, July 29, 2019, in Gilroy, Calif. Authorities on Monday were searching for answers to why 19-year-old Santino William Legan opened fire on a popular food festival at the park less than a mile from his parents' home in California. (AP Photo/Noah Berger)
In this aerial photo, emergency personnel, right, walk among vendor booths at Christmas Hill Park, Monday, July 29, 2019, in Gilroy, Calif., the site of a shooting the day before at the Gilroy Garlic Festival. Authorities on Monday were searching for answers to why a 19-year-old opened fire on a popular food festival less than a mile from his parents' home in California, killing two children and another man, but believe many more people would have died if officers patrolling the event had not stopped the gunman so quickly. (AP Photo/Noah Berger)
Candles burn at a makeshift memorial for Gilroy Garlic Festival shooting victims outside the festival grounds, Monday, July 29, 2019, in Gilroy, Calif. (AP Photo/Noah Berger)
A gunman cut through a fence to avoid security and opened fire at Northern California's popular Gilroy Garlic Festival.;