Police are warning of the dangers of foolish behaviour on railway tracks after two incidents involving children on the Chippenham line over the Easter holidays.

On one occasion all approaching trains had to be stopped after police received a report of group of eight youths throwing stones at trains.

The youths, aged mainly 15 with one 16-year-old boy, were seen crossing the tracks between Marshfield Road and Ivy Lane on the bridge next to Bewley House.

Police had to advise Network Rail to stop all trains as they could not enter the tracks while they were still live.

They also informed the British Transport Police and sent letters to the parents warning them of their children’s anti-social behaviour.

They are appealing to all parents to make sure their children know the dangers of playing near the railway.

PCSO Sarah Hardwidge said: “If you are in the way, the train won’t stop – the driver will not see you until it is too late.”

A week before, on Good Friday, a separate group of youths was caught trespassing on the railway line at Kington Langley. Three trainspotters standing on the branch line called police at 2.45pm after seeing a 13-year-old and two 14-year-olds crossing the tracks.

All three teenagers admitted trespassing and were escorted home by police.

PCSO Hardwidge said: “Not only is this an offence, it causes a huge amount of disruption. It endangers the train driver and passengers, and puts the lives of police officers at risk while they look for the youngsters.

“The youngsters don’t seem to realise how busy Chippenham station is. You’ve constantly got trains coming in from Bristol and Swindon. Some London trains can get up to 125mph and can take over a mile to stop.”

In 2011, 50 people were killed after trespassing on the railway, and there were more than 400 near misses.