Gunman who gunned down nine people at a California San Jose rail yard before taking his life had talked about killing people at work more than a decade ago, his ex-wife says.

A woman leaves the scene of a shooting at a Santa Clara Valley Transportation Authority facility on Wednesday, May 26, 2021, in San Jose, California.
A woman leaves the scene of a shooting at a Santa Clara Valley Transportation Authority facility on Wednesday, May 26, 2021, in San Jose, California. (AP)

A public transit worker has shot dead nine people at a California rail yard before turning his gun on himself as police arrived, officials said after the latest mass shooting to hit the United States.

Multiple victims were also wounded on Wednesday in the attack at the rail yard in San Jose, just south of San Francisco.

One later died at the Santa Clara Valley Medical Center where he had been hospitalised in critical condition, local media reports and a union representing the rail workers said late on Wednesday.

The attack has once again shone a spotlight on the country's rag ing gun control debate.

"What the hell is wrong with us, and when are we going to come to grips with this?" said California Governor Gavin Newsom at a press conference, where he praised the swift response of law enforcement.

Law enforcement officers had rushed to investigate multiple early morning 911 calls reporting gunshots, and entered the compound during an "active shooting," said Russell Davis, a Santa Clara County Sheriff's deputy.

They did not exchange gunfire with the shooter, who died from a self-inflicted gunshot wound.

"I know for sure that when the suspect knew that law enforcement was there he took his own life," said Santa Clara County Sheriff Laurie Smith.

The attacker was identified as 57-year-old Samuel Cassidy. He had talked about killing people at work more than a decade ago, his ex-wife said on Thursday.

"I never believed him, and it never happened. Until now," a tearful Cecilia Nelms told The Associated Press on Wednesday following the attack.

READ MORE: The US and Their Guns: An American Story | Storyteller

Biden calls shooting 'horrific tragedy'

"Our deputies were right there at that time."

Bomb squads were deployed after dogs detected "some type of explosives material at the crime scene," Davis said.

US President Joe Biden called the incident a "horrific tragedy" and ordered flags to be flown at half-staff, saying in a statement: "There are at least eight families who will never be whole again."

"Once again, I urge Congress to take immediate action and heed the call of the American people, including the vast majority of gun owners, to help end this epidemic of gun violence in America.

"Every life that is taken by a bullet pierces the soul of our nation. We can, and we must, do more."

READ MORE: US gun violence epidemic is a plague with no vaccine

'Dark moment for our city'

Cassidy, was an employee of the Valley Transportation Authority, which provides rail and bus services for San Jose, a Silicon Valley tech hub of almost a million people.

Victims including VTA employees were found shot in two different buildings on the site. The authority's chair Glenn Hendricks called the shooting a "horrible tragedy."

Dozens of police cars and fire engines lining the streets near the rail yard were joined at the scene by FBI officials. Special agent Craig Fair warned the "fairly sizable crime scene" would take a significant amount of time to process.

Nearby, anxious families of employees waited at a county building for word about the safety their relatives.

"This is a very dark moment for our city and for our community," said San Jose Mayor Sam Liccardo.

Many of those killed or wounded were essential workers who had "helped us get through this horrific pandemic" by keeping public transport operating, he added.

San Jose police were also investigating a house fire believed to be linked to the shooting. According to multiple US media reports, the blaze began at the suspect's home shortly before the attack.

The shooter's ex-wife Cecilia Nelms told the Bay Area News Group that Cassidy had "often spoke angrily about his co-workers and bosses, and at times directed his anger at her."

An ex-girlfriend additionally accused him of raping and abusing her, often during violent "mood swings," according to cour t records cited by the San Francisco Chronicle.

Local officials said the shooting, which was initially reported before 7:00 am local time (1400 GMT), had taken place at an employee meeting, with at least 80 staff on site at the time.

A vigil in honor of the victims has been scheduled for Thursday at 6:00 pm local time at San Jose's City Hall Plaza, according to Liccardo.

Gun epidemic

The United States has a long and painful history of deadly gun violence, in the form of a steady daily toll of shootings as well as high-profile mass kil lings that have targeted schools, work places and shopping centers.

Homicides, mostly gun-driven, have surged in the US over the past year.

Mass shootings have occurred in recent months at a FedEx facility in Indianapolis, an office building in California, a grocery store in Colorado and at several spas in Atlanta.

In August 2019, another mass shooting in the Bay Area left two children and a 25-year-old man dead at a garlic festival in Gilroy, around 50 kilometres south of San Jose.

Biden last month branded US gun violence an "epidemic" and an "international embarrassment."

There were more than 43,000 gun-related deaths in the United States last year, including suicides, according to the Gun Violence Archive.

READ MORE: Top US court to take up right to carry gun in public

Source: AP