SAN JOSE (KRON) – The gunman who killed nine people at a San Jose VTA railyard Wednesday has been identified as 57-year-old Sam Cassidy, a VTA employee.

Cassidy had worked for the VTA since at least 2012, according to the public payroll and pension database known as Transparent California. His position from 2012 to 2014 was listed as a mechanic. After that, he was a substation maintainer, the records said.

His ex-wife, Cecilia Nelms, told The Associated Press that Cassidy had a bad temper and would tell her that he wanted to kill people at work, “but I never believed him, and it never happened. Until now.”

Nelms, teary-eyed and shaken by the news, said her ex-husband would come home wound up and angry about things that happened at work. As he talked about it, “he would get more mad,” she said. “He could dwell on things.”

When Cassidy lost his temper, Nelms said there were times she was scared. He was someone who could physically hurt others, she said.

Nelms said they were married for 10 years – Cassidy filed for divorce in 2005 – and had not been in contact for 13 years. She said he had been treated for depression.

KRON4 spoke to Cassidy’s former girlfriend’s attorney, Robert Cummings, who said the two met on Match in 2009, and two months later he proposed. The girlfriend declined as she felt that was too fast.

Cummings said the girlfriend told him about Cassidy’s mood swings and was bipolar.

Doug Suh, who lives across the street from Cassidy, told local news outlets that Cassidy was “lonely” and “strange” and that he never saw anyone visit.

“I’d say hello, and he’d just look at me without saying anything,” Suh said. Once, Cassidy yelled at him to stay away as he was backing up his car. “After that, I never talked to him again.”

Court documents from 2009 reveal Cassidy filed a restraining order against an ex-girlfriend and another female roommate. In the documents the ex-girlfriend describes instances of sexual and physical abuse, heavy drinking and extreme mood swings due to his bipolar disorder.

The ex-girlfriend also said in documents that Cassidy would threaten to tell lies to her boss to complicate her career and would steal tools from his VTA coworkers.

Federal officials also revealed Thursday that when Cassidy was detained by U.S. customs officials in 2016 after a trip to the Philippines he spoke of hating his workplace.

Cassidy had a memo book that had notes on how he hated the Santa Clara Valley Transportation Authority. The memo also said he had books on terrorism but when he was asked whether he had issues with people at work he said no.

This is is a developing story. Check back for updates.

The Associated Press contributed to this report.