Media playback is unsupported on your device Media caption "People were running out, screaming and yelling"

A teenager who killed three people at a California food festival died from a self-inflicted gunshot wound, US authorities have confirmed.

Santino William Legan, 19, opened fire with an assault rifle at Gilroy Garlic Festival in July.

Authorities initially said he had been killed by police, but a coroner's report has ruled that he shot himself in the mouth after being injured.

Investigators say they have yet to determine a motive for the attack.

FBI Special Agent John Bennett told reporters that computer equipment, anxiety medication, and extremist materials have been seized from Legan's residence.

But Mr Bennett did not say if the attack was motivated by extremist views.

"It doesn't seem clear that he was targeting any particular group," said Mr Bennett. "It seems very random at this point."

Media playback is unsupported on your device Media caption "Who'd shoot up a garlic festival?"

Despite earlier reports of an accomplice, authorities say it is now believed he acted alone.

According to Gilroy Police Chief Scot Smithee, three police officers ran towards Legan after he began opening fire with an "AK-47-type" assault rifle he had purchased legally in neighbouring Nevada.

He was then shot "multiple times" by the officers, falling to his knees, and finally to the ground where "he was able to get a round off".

But the police chief pushed back at suggestions that the coroner's report contradicted an earlier version of events.

"In my mind, it changes nothing," he told reporters. "The officers still got there fast ... they eliminated the threat. Whether he fired that final shot, in my mind, changes nothing."

Image copyright EPA Image caption A vigil was held for the victims, which include a six-year-old-boy

Authorities have identified the three victims killed in the attack as six-year-old Stephen Romero, 13-year-old Keyla Allison Salazar and Trevor Deon Irby, 25. Sixteen others were also wounded.

The incident is the 246th mass shooting in the US this year, according to US tracking website Gun Violence Archive.