The FBI has opened a domestic terrorism investigation into the Gilroy Garlic Festival shooting, officials said Tuesday, a designation that gives the inquiry higher priority and more resources.

Investigators’ search of the gunman’s digital media showed that he had studied religious sites, federal buildings, courthouses and major political parties as other possible targets, FBI Special Agent John Bennett said. He declined to identify what they were.

Santino Legan, 19, opened fire into the crowd during the festival on July 28, killing two children and one man and injuring 13 people. Police fired on Legan, who shot and killed himself, less than a minute after he began shooting.

Legan came heavily armed with five large ammunition magazines containing hundreds of rounds, apparently intending to inflict even more carnage than he did, Gilroy police said on Tuesday.

Legan fired 39 rounds during his rampage, Police Chief Scot Smithee said. He wore a bullet-resistant vest when he cut through a fence and stormed into the festival, said Bennett of the FBI’s San Francisco Field Division, which has taken over the investigation.

The FBI now wants to learn who, if anyone, helped the shooter, who may have been in contact with him, and who else might have had advance knowledge of his intentions, Bennett said.

“The investigation remains ongoing,” he said. And despite the death of the suspect, the FBI is notifying those who were his apparent targets.

Terrorism cases are the department’s No. 1 priority, said Michael German, a former FBI agent who now is an analyst with the Brennan Center for Justice at New York University. Terror investigations are broad-ranging, “seeking information about who might have been involved, who provided support to the person, any existing remnants of the organization that continue to pose a threat to the public.”

The three police officers who engaged Legan fired a combined 18 rounds, striking him an unknown number of times, before he turned his rifle on himself and fatally shot himself in the head.

Smithee said none of the officers’ 18 rounds struck anyone else.

No one has ever been charged with terrorism for lethal acts on U.S. soil that were unrelated to a foreign organization.

The USA Patriot Act, passed after the Sept. 11, 2001, terrorist attacks, defined domestic terrorism in the same way that an earlier law had identified international terrorism: criminal acts that endanger human life and are intended to intimidate or coerce either a civilian population or government policy through kidnapping, assassination or mass destruction.

The only difference is that international terrorism must take place outside the United States or must “transcend national boundaries,” a somewhat imprecise term that has been interpreted to cover domestic acts related to international terrorists. The international designation also allows law enforcement to seek warrants to conduct secret surveillance to monitor communications of suspected foreign agents or terrorists.

As a result of the domestic terrorism declaration, Bennett said the FBI can now send out subpoenas and follow leads across the country.

The chilling morning announcement from the police and FBI at Gilroy police headquarters showed the devastation at the popular festival could have been far worse had the three officers not engaged the suspect almost immediately after the shooting started.

Bennett said agents had established no motive for the shooting.

The investigation has found “evidence that the shooter was exploring varied and competing violent ideologies.”

The Chronicle previously reported that materials found in a Nevada home in which Legan stayed in the weeks before the shooting included literature related to white supremacy and Islamic extremism.

On Tuesday, Bennett said it was unclear which, if any, he may have settled on.

“One piece of evidence does not necessarily constitute a motive,” Bennett said earlier.

Victims killed in the shooting were 6-year-old Stephen Romero of East San Jose; 13-year-old Keyla Salazar of San Jose; and Trevor Irby, 25, of upstate New York. On Tuesday, about 200 people attended Keyla’s funeral at Our Lady of Guadalupe Church in San Jose.

Smithee said the suspect brought with him a 75-round drum magazine that still contained 71 rounds. He also had four 40-round magazines — two on his body and two on the ground — and shotgun ammunition. Police also found a shotgun in Legan’s car, and a bag loaded with materials meant for destruction, he said, including loose rifle rounds, a rifle scope, two loaded magazines and buckshot.

The shooting lasted less than a minute. In that time, the peaceful festival grounds turned into a bloody scene of triage. Those who died in the shooting suffered gunshot wounds to the chest and back, the Santa Clara County coroner said Monday.

Bennett of the FBI said Tuesday that none of those killed or injured was hit by friendly fire.

In a statement released by their attorney, Legan’s family said all members are cooperating with the investigation.

“Our family is deeply shocked and horrified by the actions of our son,” according to the unsigned statement. “We have never and would never condone the hateful thoughts and ideologies that led to this event, and it is impossible to reconcile this with the son we thought we knew. Our son is gone, and we will forever have unanswered questions as to how or why any of this has happened.”

The family apologized to the families of those killed, to the city of Gilroy, “and to everyone affected.”

The FBI said it had completed its investigation at the festival grounds, but Smithee said the park would remain closed until belongings left at the scene had been returned to owners.

A Family Assistance Center for victims has been set up at the community center in the main library, a spokesman for the Santa Clara County district attorney said.

Steve Rubenstein and Nanette Asimov are San Francisco Chronicle staff writers. Email: srubenstein@sfchronicle.com nasimov@sfchronicle.com Twitter: @SteveRubeSF @NanetteAsimov