For 87 years, nearly every day, a single train ran out of London and back. It left from a dedicated station near Waterloo built specifically for the line and its passengers. The 23-mile journey, which had no stops after leaving London, took 40 minutes. Along the way to their destination, riders glimpsed the lovely landscapes of Westminster, Richmond Park and Hampton Court - no mistake, as the route was chosen partly for its "comforting scenery", as one of the railway's masterminds noted.

How much comfort a route gives passengers isn't a usual consideration for a train line. But this was no normal train line.

Many of the passengers on the train would be distraught. The others - those passengers' loved ones - would be dead. Their destination: the cemetery.

In operation from 1854 to 1941, the London Necropolis Railway was the spookiest, strangest train line in British history. It transported London's dead south-west to Brookwood Cemetery, near Woking, in Surrey, a cemetery that was built in tandem with the railway. At its peak, from 1894 to 1903, the train carried more than 2,000 bodies a year.

It also transported their families and friends. Guests could leave with their dearly departed at 11:40am, attend the burial, have a funeral party at one of the cemetery's two train stations (complete with home-cooked ham sandwiches and fairy cakes), and then take the same train back, returning to London by 3:30pm.

I consider it improper - Bishop of London, 1842

The pairing of grief and efficiency may seem a little jarring. It did then, too. "I consider it improper," sniffed the Bishop of London, testifying on the proposal before a House of Commons Select Committee in 1842. "At present we are not sufficiently habituated to that mode of travelling not to consider the hurry and bustle connected with it as inconsistent with the solemnity of a Christian funeral."

But people became accustomed to it, says John Clarke, a historian who has written a book on the railway - so much so, some failed to see what was odd about it at all. During his research, Clarke says, he asked one of the railway company's former stonemasons if he had any photographs of the train. The stonemason, surprised, asked, "No - why would I have that?"

Clarke explains: "For the people who worked at the cemetery, and for the [railway] company, it was what they did - and it wasn't unusual."

Still, that's not to say that the idea of operating a train that exclusively transported dead bodies and mourners to a cemetery seemed 'normal' when it was first proposed. Critics claimed that a train was too mechanical, too perfunctory, for the delicate work of funeral rites. They also worried that trains carrying corpses would later carry passengers - a mix of living and dead riders would make for an unpalatable commute. That was one reason that the line had its own dedicated train stock.

Others expressed concern that different social classes would mix. There were separate carriages for each class, as was the custom at the time - and continues to be the case on many British trains today. Even so, the fact that both banker and beggar would ride the same train and alight at the same cemetery station was somewhat egalitarian. So was the cemetery itself, which was divided not by class or status, but by religion - Anglican burials, for example, were separated from other Christian denominations.

Despite trepidation, the government went ahead with the plan anyway. In many ways, it had to.

By mid-19th Century, London's cemeteries were notoriously overcrowded. And as the city's population grew, more than doubling from 1801 to 1851, the situation only worsened. Every year, London was burying another 50,000 dead - but burial space remained less than 300 acres. That left gravediggers to turn to some particularly distasteful solutions, like digging up previously-buried bodies and cremating them at night. (Find out more about London's abundance of human remains and how they affect even modern train lines in our recent story about London rail and mass graves of plague victims). Only those who could afford spots in new, exclusive burial grounds like Highgate Cemetery, London's most famous cemetery, were exempt from possibly being exhumed and unceremonially cremated.

Every year, London was burying another 50,000 dead - but burial space remained less than 300 acres

Eventually Parliament shut the cemeteries of inner London to new burials and opened seven large, suburban cemeteries. There, the land was green. It was cheap. And there was plenty of room. Brookwood Cemetery alone included more than 1,500 acres, compared to just 218 acres of burial space within London. Nicknamed the London Necropolis, at one time it was the largest burial ground in the world.

The problem was how to get there.

Passengers were one thing. They could alight at Brookwood Station, which was opened three-quarters of a mile from the cemetery in 1864 to serve both the necropolis and the 'normal' train line. The station still functions today.

But the dead were another issue altogether. Carrying corpses 23 miles via horse and carriage was slow and far too expensive for most Londoners. It was especially untenable because those behind the suburban cemeteries were hoping for a lot of corpses. Using a dedicated railway to carry coffins - and to bring both the dead and their funeral guests all the way into the cemetery - seemed like an elegant solution.

It was pioneering; it was revolutionary - John Clarke

"It was pioneering; it was revolutionary," says railroad historian Clarke. "As far as I know, it was the first use of the railway for a dedicated service from one private station, directly into a cemetery at the other end."

But more than just track and stations in the cemetery were built exclusively for the necropolis railway. In London, York Street station was constructed near Waterloo station - but just far enough from the normal commuters so as to be discreet, notes George Nash in his essay Pomp and Circumstance: Archaeology, Modernity and the Corporatisation of Death.

Another perk of the location was Waterloo's railway arches, which acted as "ideal temporary storage space of corpses", Nash writes. Along with two entrance halls (one for the upper class, one for the middle and lower), waiting rooms and platforms, the station also had mortuaries.

The process was straightforward. Most families had their loved one picked up by a horse-drawn hearse. The funeral procession would end at the station; there, the coffins would be lifted into elevators that would carry them up to the platform level and onto the train.

The train - outfitted with leather straps to keep the coffins secure - would carry both the mourners and deceased. Fares were capped by the Act of Parliament that had established the railway, and remained constant throughout the railway's lifetime: six shillings for a return first-class ticket (in 1854, this was worth about £25 in today's terms), down to two shillings (about £8) in third. For the dead, it cost £1 in first class and 2s 6d in third.

When it arrived at the cemetery, the group could get off at South Station (where the Anglican section was) or North Station (for Non-Conformists) for the funeral. Afterwards, refreshment bars at the stations served up snacks and pints.

Possibly this is the most peaceful railway station in the three corners of the kingdom - Railway Magazine, 1904

"Possibly this is the most peaceful railway station in the three corners of the kingdom - this station of the dead," wrote Railway Magazine of the cemetery stations in 1904. "But this is a sad station, the saddest in our islands. For every time it is used means an occasion of grief and pain to those who tread its platforms."

Peaceful or not, the necropolis railway never took off in the way planners had hoped.

"The original aims of the company, to effectively offer economic and sanitary burial well beyond the city limits, forever if necessary - that could have been achieved. But the public, having the choice of burial place, decided otherwise," says Clarke. "Most people aspired to being buried near where they lived and worked. The idea of being buried nearly 30 miles out of central London - that was quite a choice to make."

There was also the issue of timing. With its once-a-day run, the necropolis train schedule was inflexible. If a funeral or a graveside visit was any day but Sunday, it meant taking a day off work, something many could ill afford to do - and that others, like those in London's workhouses, were forbidden.

In 1909, the motor hearse was introduced. By the 1920s, it had overtaken both the horse-drawn hearse and the train.

The true death knell to the railway, though, came in 1941. On one of the worst nights of the Blitz, on 16 April, bombs killed more than 1,000 people and caused more than 2,000 fires - including one that ripped through the London Necropolis Railway Station. Most of the building was destroyed.

By that point, the train was already running just one or two journeys a week. Rather than reconstruct the station and order new stock, company officials chose to close down the line.

At Brookwood Cemetery, a reconstructed North Station still stands today. But in London, all that remains is the former office building at 121 Westminster Bridge Road. Its elaborate Victorian façade is intact - but the name LONDON NECROPOLIS RAILWAY, once inscribed in the awning's stone, has long since been scrubbed away.

This story is a part of BBC Britain - a series focused on exploring this extraordinary island, one story at a time. Readers outside of the UK can see every BBC Britain story by heading to the Britain homepage; you also can see our latest stories by following us on Facebook and Twitter.