Media playback is unsupported on your device Media caption British Transport Police footage of trespassing on the rails

Teenagers are risking their lives to take selfies on train tracks with the number of young people trespassing on lines more than doubling in the last three years.

Official figures show people went onto the tracks 400 times in 2014-15, 86 of which were under-18s.

By 2017-18, this had leapt to 586 cases - 173 youths.

British Transport Police said the tracks were "not a playground" and people could be seriously hurt.

A survey of 1,000 teenagers across the UK - including 39 in Wales - carried out on behalf of Network Rail showed 18% did not know walking along railway tracks was illegal.

Network Rail also said a fifth of the teenagers surveyed in Wales admitted they went on the tracks to take a picture or have their photo taken.

Bill Kelly, acting route managing director for Network Rail in Wales and Borders, said: "Hundreds of people each year unintentionally take on the railway and lose.

"Trains can travel up to 125mph, so even if a driver can see you, they can't stop in time and they can't change direction."

Image copyright Network Rail Image caption Footage captured this boy running across the tracks to avoid an oncoming train

Meanwhile, virtual reality technology will be used in to teach pupils in schools and to train railway workers about the hazards on the lines.

It was developed by Motion Rail with the University of South Wales' Centre of Excellence in Mobile and Emerging Technologies.

With 1,150 level crossings and 1,487 miles of track in the Wales and Borders area, managing director Emma Gilchrist said there are "many areas that could be considered dangerous".

Its not-for-profit work in schools will focus on challenging research, including figures that show 70% of adults believe using level crossings when the barriers are down is safe if no trains are coming.

More than 28% of people also believe crossing a motorway is more dangerous than crossing a railway.

'Devastating consequences'

Across the UK in the past 12 months, seven under-18s were killed on the tracks and a further 48 suffered life-changing injuries.

The summer holidays see double the number of cases of trespassing compared to winter, so police have encouraged all schools to write to parents to stress the dangers posed by trains.

British Transport Police officers will also increase patrols.

Arriva Trains Wales acting operations manager Martyn Brennan said: "Every year our train crews see hundreds of cases of trespass taking place and it really is something we need to tackle.

"Tragically far too many of them have seen the devastating consequences it can have."