This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

A gunman who killed nine people at a California rail yard where he worked appeared to target some of the victims, a sheriff told The Associated Press on Thursday, while a Biden administration official said the shooter spoke of hating his workplace when customs officers detained him after a 2016 trip to the Philippines.

Samuel Cassidy, 57, arrived at the light rail facility for the Valley Transportation Authority in San Jose around 6 a.m. Wednesday with a duffel bag filled with semi-automatic handguns and high-capacity magazines, Santa Clara County Sheriff Laurie Smith said.

“It appears to us at this point that he said to one of the people there: ‘I’m not going to shoot you,’” Smith said. “And then he shot other people. So I imagine there was some kind of thought on who he wanted to shoot.”

While there are no cameras inside the rail yard’s two buildings, Smith said footage captured him moving from one location to the next. It took deputies six minutes from the first 911 calls to find Cassidy on the third floor of one of the buildings, Smith said.

Cassidy, who fired a total of 39 bullets, killed himself as deputies closed in on the facility serving the county of more than 1 million people in the heart of Silicon Valley. More than 100 people were there at the time, and authorities found five victims in one building and two in another, Smith said.

Kirk Bertolet, 64, was just starting his shift when shots rang out. He said Thursday that Cassidy worked regularly with the victims. He called them “a good bunch of blue-collar people” but said Cassidy stuck out as a loner and outsider.

“I know some of those guys, they’ll keep joking with you and they’ll keep hammering you about stuff. And if you’re thin-skinned and you can’t take it … I see that is the main cause of what’s going on,” Bertolet said.

Sheriff’s officials described Cassidy as “a highly disgruntled VTA employee for many years,” saying that may have contributed to him targeting the workers. Documents show he had worked at the transit authority since at least 2012.

Bertolet, a signal maintenance worker who worked in a separate unit from Cassidy, said he is convinced Cassidy targeted his victims because he didn’t hurt people he encountered on the way to the second building, where more shots were fired.

“Sam made sure he killed all who he wanted. He made sure they were dead,” Bertolet said. “I watched some of my coworkers breathe their last breaths, and they were all gone. Seven of them were just gone.”

After being detained by customs officers in 2016, Cassidy spoke of hating his workplace and he was found to have a memo book with notes on how he hated the Valley Transportation Authority, according to a Biden administration official who described a Department of Homeland Security memo laying out Cassidy’s statements. The official saw the memo and detailed its contents to the AP but was not authorized to speak publicly about the ongoing investigation.

The Wall Street Journal first reported the memo.

It doesn’t say why he was stopped by customs officers. It said he had books about “terrorism and fear and manifestos” but when he was asked whether he had issues with people at work, he said no. The memo notes that Cassidy had a “minor criminal history,” citing a 1983 arrest in San Jose and charges of “misdemeanor obstruction/resisting a peace officer.”

Cassidy’s ex-wife said he had talked about killing people at work more than a decade ago.

“I never believed him, and it never happened. Until now,” a tearful Cecilia Nelms told the AP on Wednesday.

She said he used to come home from work resentful and angry over what he perceived as unfair assignments.

“He could dwell on things,” she said. The two were married for about 10 years until a 2005 divorce filing, and she had not been in touch with Cassidy for about 13 years, Nelms said.

An ex-girlfriend described Cassidy as volatile and violent in court documents filed in 2009, with major mood swings because of bipolar disorder that became worse when he drank heavily. Several times while he was drunk, Cassidy forced himself on her sexually despite her refusals, pinning her arms with his body, the woman said in a sworn statement filed after Cassidy sought a restraining order against her. The documents were obtained by the San Francisco Chronicle.

Sheriff’s officials said the three 9 mm handguns Cassidy brought to the rail yard appear to be legal. Authorities do not yet know how he obtained them.

He also had 32 high-capacity magazines, some with 12 rounds. In California, it is illegal to buy magazines that hold more than 10 rounds. However, if Cassidy obtained them before Jan. 1, 2000, he would have been allowed to have them unless he was otherwise prohibited from possessing firearms.

The sheriff said authorities found explosives at the gunman’s home, where investigators believe he had set a timer or slow-burn device so that a fire would occur at the same time as the shooting. Flames were reported minutes after the first 911 calls came in from the rail facility.

The attack was the 15th mass killing in the U.S. this year, all shootings that claimed at least four lives each for a total of 87 deaths, according to a database compiled by The Associated Press, USA Today and Northeastern University.

President Joe Biden urged Congress to act on legislation to curb gun violence, saying, “Every life that is taken by a bullet pierces the soul of our nation. We can, and we must, do more.”

Several long-time employees were killed, many of whom worked together.

“Whatever happened yesterday, it shows the character of these guys, how they tried to save others while going through that chaotic situation,” light rail superintendent Naunihal Singh said.

The victims were Alex Ward Fritch, 49; Paul Delacruz Megia, 42; Taptejdeep Singh, 36; Adrian Balleza, 29; Jose Dejesus Hernandez, 35; Timothy Michael Romo, 49; Michael Joseph Rudometkin, 40; Abdolvahab Alaghmandan, 63; and Lars Kepler Lane, 63.

Family and friends remembered Taptejdeep Singh as a hero. He called another transit employee to warn him about Cassidy, saying he needed to get out or hide.

“He told me he was with Paul, another victim, at the time,” co-worker Sukhvir Singh, who is not related to Taptejdeep Singh, said in a statement. “From what I’ve heard, he spent the last moments of his life making sure that others — in the building and elsewhere — would be able to stay safe.”

Karman Singh said Thursday that his older brother had “a lion’s heart.”

At an evening vigil that drew 1,000 people to City Hall, Singh said his brother “died fighting for others, and trying to save his community, his VTA community.”

Annette Romo, wife of Timothy Romo, told the crowd: “I only have a few words to say: Never leave home without giving your loved one a kiss goodbye. Because that was the last I got.”

GoFundMe has set up page of verified fundraising accounts to help the victims of the mass shooting. More information can be found here.