A child was witnessed lying with his head over the edge of a railway station platform prompting an investigation by British Transport Police.
A photo posted online of the incident, which took place in Trowbridge, Wiltshire on Saturday afternoon, has since gone viral on social media.
Tim Brown, who took the photo, said when he challenged the boy’s guardian he was told he was a “do-gooder”.
Mr Brown, from Birmingham, described it as “absolutely unbelievable”.
He said when he explained to the man, who was also with two young girls, that “people are seriously injured and die doing this”, the man replied “the train’s not due” and “he only wants to look at the track”.
Mr Brown, who works for Network Rail, said he pointed out that freight or unscheduled trains could pass through at any time and he reported the matter to a guard.
On Facebook, David Routley wrote: “As a freight train driver who drove a 1,000 tonne train through this station yesterday morning, to see this scares and shocks me to the core.”
Hanif Ali added: “What world is he living in? If he can’t see the obvious dangers then he shouldn’t be allowed anywhere near children.”
British Transport Police confirmed it had been notified and was awaiting further information prior to launching an investigation.
A spokesman for Great Western Railway (GWR), which manages Trowbridge railway station, said: “Trains often pass through railway stations without stopping and without appearing on any timetable at very high speeds.
“Stay safe by keeping back from the platform edge and behind the yellow line at all times, and listen out for announcements.”