Hundreds of passengers on board a commuter train were so engrossed in their mobile phones and tablets that they failed to spot a man wielding a gun before he shot and killed an innocent university student in San Francisco.

Officers studying CCTV of the murder of Justin Valdez said the gunman pulled out and aimed the weapon several times while riding on the train - even wiping his nose with it at one point - before eventually using it to kill the 20-year-old.

District Attorney George Gascon said: “These weren't concealed movements. The gun is very clear”.

Download the new Independent Premium app Sharing the full story, not just the headlines

He added: “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.”

Authorities told the San Francisco Chronicle that the CCTV footage clearly shows the killer raise a .45 calibre pistol and point it across the train carriage several times during the journey.

Prosecutors say they believe the movements may have been an attempt by the killer to choose his victim, as well as a potential line of fire.

30-year-old Nikhom Thephakaysone is accused of fatally shooting Mr Valdez in the back of the head on September 23. He has pleaded not guilty to murder and a number of other charges.

Police in San Francisco said that people who pay too much attention to technology while travelling could not only miss witnessing violent incidents on others, but may also be a far higher risk of crime themselves.

Police Chief Greg Suhr said: “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”.