Image copyright Ian Kirby/Flickr Image caption The Dawlish coastal section is part of one of the UK's most scenic stretches of line

The collapse of the railway line at Dawlish last year generated major headlines but it's not the only stretch under threat.

The coastal railway line from Carlisle to Barrow-in-Furness is one of the most scenic in Britain. In places it runs at the foot of cliffs immediately above the water. That means it's also one of the most vulnerable lines in the country, always at risk from the destructive power of the sea, or from rock falls, or from both.

The tiny unmanned halt at Flimby, just north of Workington, is a bleak and windswept place in January. It's also one of the most exposed stretches of the line - the track here runs almost at sea level right along the back of the beach, divided from it only by a low earth bank. And on 3 January last year, a few hundred metres south of Flimby station, the line ended up under water.

Ian Joslin, the local area director for Network Rail, called the circumstances that night "a perfect storm". High tides combined with strong onshore winds and washed away the earth bank and 200m of the ballast underneath the track. The rails were left hanging unsupported in the air.

Sound familiar? A month later on the night of 4-5 February the tracks of the main railway line to Plymouth and Penzance were similarly left hanging when a storm destroyed part of the sea wall at Dawlish, on a spectacular stretch where the line weaves along a man-made ledge and through tunnels at the foot of red sandstone cliffs.

Image copyright Gwyn/Flickr Image caption A section of the vulnerable Cumbrian rail line

That closure was national news. The prime minister was deployed to survey the damage. And it was two months before the line reopened, after Network Rail rebuilt the sea wall.

During the same January storms that destroyed the line at Flimby, the Cambrian Line along the coast of west Wales from Machynlleth through Barmouth to Pwllheli was also breached in several places. Stranded trains had to be taken away by road on low-loaders. That line wasn't fully back in operation until May, five months later. Neither that breach nor the one in Cumbria made the national news.

The Cumbrian coast line at Flimby took just a week to reopen. It was no mean feat. "We had to come and repair the sea defences which involved bringing in a significant amount of rock armour," says Joslin. "We had wagons and lorries arriving around the clock for the first three or four days. And we also had to repair the integrity of the track, the bottom ballast, the actual sleepers and rail."

Several hundred people - Network Rail staff and contractors - were involved. A quarry at Shap opened over the weekend to supply the rock armour, basically massive boulders dumped between the rails and the beach to dissipate the force of the waves. It was a big project which might have taken several months to plan in ordinary circumstances. On this occasion, it was put in place virtually overnight.

Image copyright Network Rail Image caption Flimby damage

Nonetheless, the closure was a nuisance for regular travellers on the line. Student Jasmine Ritchie, waiting at Workington for the 07.42 to Carlisle, says: "I had to get the bus to college which was £5, so three times going to college was £15, which is a lot of money for a 16-year old."

Last year Network Rail spent £2.3m repairing the sea defences along this line. And as I interviewed those commuters, a deafening reminder of the line's strategic importance came rumbling by - two heavy goods locos pulling a single wagon on which sat what looked like a nuclear flask. This is the line to the nuclear reprocessing plant at Sellafield.

Joslin agrees that makes it very important - and it may become even more important if plans for a nuclear power station next to Sellafield come to fruition. At that point Network Rail's existing policy of patching the line up piecemeal may no longer be sustainable, and parts of it may need serious investment to bring it up to scratch.

There are stretches of coastal railway all round Britain, and many are vulnerable to storms, erosion or landslides. Besides the three lines which had to be closed last year, there's the mainline along the north Wales coast from Chester to Holyhead, the line from Folkestone to Dover (where the principal danger is from landslips), the line along the north shore of the Firth of Forth and shorter stretches beside estuaries and beaches elsewhere.

Image copyright Richard Szwejkowski/Flickr Image caption En route to Pwllheli

A new book, On the Edge by Prof Robert Duck, looks at the history of coastal railways, the impact they've had on the environment and on the people who live beside them and travel on them, and at what the future may hold. Duck is a geologist by training, professor of environmental geoscience at Dundee University and an expert on coastal erosion.

He says Victorian railway companies built by the coast because it was often flat and the land was cheap - the crown customarily owned the foreshore, and in the 19th Century it was seen as waste ground ripe for development. But in the process those Victorian engineers badly disrupted natural processes and stored up problems for the future.

"You've got to remember the railway companies in those days were incredibly ruthless," Duck says. "They were rivals, they were competing for traffic and in the industrial revolution all that mattered was improvement and progress. The impact on the natural environment, on the coasts, didn't come into anyone's minds at all.

Image copyright Getty Images Image caption Isambard Kingdom Brunel: Versatile and audacious

"They were trying to do things as cheaply as possible, and they were often acquiring materials locally. They got sand and gravel locally from beaches, but the fact that they lowered the beach levels just meant bigger waves crashed in."

The very act of putting a sea wall with a railway on at the foot of a cliff just makes erosion worse. It's what Isambard Kingdom Brunel, that most heroic of all Victorian engineers, did at Dawlish. The beach at the foot of the wall is scoured out by the waves, and the beach materials are no longer naturally replenished by rock falls from the cliffs.

Add in the effects of climate change - an increase in extreme weather events like storms and a rise in average sea level - and Duck says we have a problem that's only going to get worse.

The man responsible for repairing the Dawlish line last winter was Mike Gallop, Network Rail's director of asset management for its Western route. He admits the line there is highly vulnerable. "If you were going to build a railway line today you wouldn't build it there," he says. But that doesn't mean Network Rail is prepared to write it off - or any other coastal railway.

So why did it take just two months to reopen the line at Dawlish, but five months to reopen parts of the line in Wales? Doesn't that suggest that some lines have a higher priority than others? Not so, he says.

"The response was different in west Wales because, for instance, it's further away from the places where construction companies are based," he says. "Just the logistics of getting things to and from the Cambrian coast are so much more difficult than operating near large urban areas like Exeter or Plymouth. Our response is different because the geography that we operate is different, not because we value rural lines less than mainlines."

Nor is Network Rail in the business of closing lines, whatever others may suggest.

According to Duck, "There is no doubt that many of our lines close to the coast are taking a really severe pounding, and this is something we're going to have to do something about if we're going to keep open these key routes. It'll have to be a combination of hard engineering - that will definitely be part of it - but in certain places we will also have to look at the possibility of rerouting lines to more inland locations. The costs of that will be very high, but I think the benefits will in the long run outweigh that."

Image copyright Getty Images Image caption Dawlish after the 2014 breach (above) and the repaired track

He points to the South Devon line as a prime candidate for rerouting inland, adding: "In the end, the sea will win - it's not just a question of building bigger defences."

But Gallop doesn't accept the fate of the lines is inevitable. Does he foresee a time when he might have to go to the government and ask to close or move an existing line? No, he says, he couldn't.

On my visit to Cumbria I also met Tony Potts, chair of the Copeland Rail Users Group which represents travellers on the Carlisle-to-Barrow line. As the wind got up and the rain came down he took me in his car to a viewpoint in Whitehaven from which we could see, through the windscreen wipers, where the railway curved around a headland. Traditionally, he told me, this was said to be the most expensive bit of line to maintain in the country. "If it weren't for Sellafield, there wouldn't be a line south of Whitehaven," he added.

But he is full of praise for Network Rail's efforts to keep it in good repair and says most local people understand that a line so close to the sea brings with it inevitable problems.

Past Parton and Harrington the line back to Carlisle runs right above the sea. The train slowed to a crawl, the waves crashed against the sea wall below us, and the spray splashed the windows. It was rather exciting - and also just a teeny bit alarming.

The slip on the South Devon Railway

Image copyright ALAMY

A letter to the Times newspaper, dated 1 January 1853, written by someone calling themselves "A Lover of Truth":

Sir, Observing a very slight notice in your valuable journal of this occurrence, which is calculated to mislead the public as to the extent of damage done, and to the probability of the reopening of the line, I beg to send you the facts as they are, and the probabilities of impending accidents.

Previous to the opening of this coast line - which for 20 miles runs beside the water, and 16 of which are subject to the wash of the tide - it was well said by a contemporary of the press that "Old Neptune would always claim his share" before the proprietors could receive their dividend. For the last three weeks a number of men have been employed in removing the fallen earth and watching the impending slips of the cliffs between Dawlish and Teignmouth. On Wednesday last a slip of the side of the cliff between the above-named towns took place (about 4,000 tons), which completely broke up the rails and forced the sea wall into the tideway.

The UK's most scenic rail line?

Subscribe to the BBC News Magazine's email newsletter to get articles sent to your inbox.