Three people have been killed and 15 injured in a shooting at a food festival in California, local police have confirmed.

One gunman has been shot dead by police, although it is unclear whether there is a second suspect at large.

The Gilroy Garlic Festival was about to end for the weekend on Sunday evening, when shots were fired at the site.

There was “a white man in his early to mid-30s firing a rifle,” eyewitness Julissa Contreras told NBC.

Video posted on social media showed people running away from the festival, 30 miles (48km) south of San Jose.

“What’s going on?” a woman’s voice asks in one video. “Who’d shoot up a garlic festival?”

Police have said the scene is “still active”.

“This is nothing short of horrific,” tweeted California Governor Gavin Newsom.

US President Donald Trump also tweeted about the shooting, urging people to “be careful and safe”.

Gilroy City councillor Dion Bracco told several US media outlets that three people had been pronounced dead.

At least 11 people, some in a critical condition, were being treated for injuries, a spokeswoman for the Santa Clara Valley Public Health System said.

The Santa Clara County Medical Center has so far admitted five victims, CBS reports. Two patients are being treated at a medical centre at Stanford University, according to CNN.

Michael Paz, 72, a hat vendor at the festival, told the San Francisco Chronicle that he saw a gunman armed with a rapid-fire assault rifle.

“He came ready to shoot because he was wearing a protective vest,” Paz said. “He was shooting left; he was shooting right without any particular aim.”

As police swooped on the gunman and shots were fired, festival attendees dropped to the ground, Mr Paz said.

“It was just rapid firing,” Ms Contreras told NBC Bay Area. “I could see him shooting in just every direction. He wasn’t aiming at anyone specifically.

“It was just left to right, right to left. He definitely was prepared for what he was doing.”

Evenny Reyes, 13, was among those who scattered in confusion when gunfire erupted at around 17:30 local time (00:30 GMT Monday).

“We were just leaving and we saw a guy with a bandana wrapped around his leg because he got shot,” she told the San Jose Mercury News.

The Gilroy Garlic Festival has been held annually since 1979. Christmas Hill Park, where the event was taking place, bans weapons of any kind, according to the festival’s website.