A 17-year-old high school student was arrested Friday for attacking a 48-year-old man with a hammer on a JR Negishi Line train earlier in the day, police said.

The youth was caught by the man he attacked and was handed over to prefectural police authorities. He was immediately arrested for attempted murder.

The second-year student from a Yokohama private high school reportedly told investigators he had been told in a dream to kill someone. His name has not been released because of his age.

The train was on its way from Konandai station to Hongodai station when the youth attacked the man, who was sleeping in his seat. After hitting him twice on the forehead, the man wrested the weapon from the boy, scolded him and turned him over to Ofuna police.