Authorities have hit out at passengers on a crowded commuter train who were so engrossed in their phones and tablets that they did not notice a man wielding a gun - until he randomly shot and killed a university student.
Security video footage showed the gunman pull out the .45-calibre pistol, raise it and point it across the aisle before putting it back against his side, prosecutors in San Francisco said.
The man drew the gun several more times and once wiped his nose with the hand holding the weapon.
"These weren't concealed movements - the gun is very clear," district attorney George Gascon said.
"These people are in very close proximity with him, and nobody sees this. They're just so engrossed, texting and reading and whatnot. They're completely oblivious of their surroundings."
San Francisco police officials said people who pay too much attention to digital technology are also vulnerable to theft.
"Oftentimes when you interview people who get their phones stolen, when you ask them to describe where the person came from, what he was wearing, they have no idea," said police chief Greg Suhr.
Nikhom Thephakaysone, 30, has pleaded not guilty to charges including murder over the September 23 attack on Justin Valdez, 20, a student at San Francisco State University who was shot in the back of the head as he left the train.
Thephakaysone has also been charged with assault with a semi-automatic handgun. Prosecutors said he stuck a gun in another man's back earlier the same night as he looked for a victim.
He did not pull the trigger and went on the hunt again for a victim for more than an hour, at one point waving a gun outside a Thai restaurant, assistant district attorney Scot Clark said.
He was also charged with illegally possessing an assault weapon after police said they seized two rifles, combat knives and razors at his home.
Police said he was carrying $20,000 dollars in cash when he was arrested.