The gunman who killed three people at a California food festival died from a self-inflicted gunshot wound, the medical examiner’s office said Friday.

Gilroy police had said that three of its police officers fatally shot the gunman, 19-year-old Santino William Legan, after he opened fire on a crowd at the annual Gilroy Garlic Festival on Sunday, killing three people and wounding others in what appears to be a random attack.

Gilroy Police Chief Scot Smithee said at a news conference Friday that the medical examiner’s office ruling does not change the fact that the officers fired at the gunman and that the suspect was struck before he apparently took his own life.

"I do know that the suspect was hit multiple times by the rounds that our officers fired, which put him down," Smithee said.

"It appears now ... that once he was down that he was able to get a round off and he shot himself, and it sounds like that round was to the head," the police chief said.

Smithee also said that when the three officers ran to the area where the shooting occurred and engaged the gunman, “the suspect immediately changed his fire from the crowd toward the officers."

A spokeswoman for the Santa Clara County Office of the Medical Examiner-Coroner told the Los Angeles Times on Friday that the cause of death of the gunman was determined to be an "intra-oral" gunshot wound.

Officials also said in an incident update Friday that the coroner made a preliminary finding of the cause of manner of death and that it was determined to be a self-inflicted gunshot wound, but said that a full report with more information would be made available in the future.

An email to the medical examiner’s office by NBC News was not immediately returned after business hours Friday.

Three people — two children and a man — died in the attack around 5:40 p.m. Sunday.

They have been identified as 6-year-old Stephen Romero, 13-year-old Keyla Allison Salazar and Trevor Deon Irby, 25.

Police have said that the gunman was armed with an assault-style rifle.

A motive in the attack is under investigation.

FBI Special Agent in Charge John F. Bennett of the San Francisco field office said Thursday that "it doesn’t seem clear that he was targeting any particular group” and that “it seems very random at this point."

Smithee said that as the suspect was being struck by rounds from the officers, he went down to his knees and then to the ground. “But I don’t have enough data to suggest at what point during that sequence of events this round from his rifle may have been fired,” he said.

Smithee said he did not know how many times the officers fired and did not know how many times the suspect was struck except that early reports say it was multiple times.

"In my mind it changes nothing," Smithee said of the cause of death determination. "The officers still got there fast, they engaged him fast, they drew his fire and they eliminated the threat. Whether he fired that final shot or not is — in my mind changes nothing."