Police are warning of the dangers of trespassing on railway lines after tourists were spotted taking photos on the viaduct which features in the Harry Potter films.

During the summer, a couple with a young child were seen running on the railway line near the Glenfinnan viaduct in the Highlands while two men were also spotted on the track taking photographs.

The viaduct is on the route of the Jacobite Steam Train and also featured in several Harry Potter films when the Hogwarts Express crossed over it.

British Transport Police (BTP) said it has recently been made aware of a number of incidents where people have been seen on the railway line trying to view or photograph trains as they pass over the iconic structure, or walking on the West Highland Line towards Mallaig.

On one occasion a group of hillwalkers appeared to be wandering casually on the line between Glenfinnan and Arisaig.

BTP constable Nicky Ritchie said: "We know that visitors, many of them foreign, want to enjoy this incredibly scenic area and are keen to see and capture the trains, particularly steam trains, crossing what is without doubt a magnificent structure.

"However, they have to realise that they need to do it safely and without breaking the law.

"We have been working closely with Network Rail to advise local people, sightseers and tourists about the dangers of trespassing and the possibility of disrupting the rail network.

"I'm grateful for the co-operation of West Coast Railways, who carry thousands of tourists to the area each year, who have now included advice on their website for anyone booking a trip on one their charter steam trains.

"The proprietors of the Glenfinnan station visitor centre are also assisting us by making sure visitors are aware of the need to stay off the tracks."

Mark Henderson, senior community engagement manager for Network Rail, warned of the dangers of trespassing.

He said: "Trespassing is extremely dangerous and can have tragic consequences for those involved.

"Trains travelling at speed take a long time to stop and anyone struck by one is likely to be killed or very badly injured.

"We work closely with BTP to educate the public on the dangers of misusing the railway and are committed to making sure people fully understand the risk they face when straying onto operational railway land."