Rail enthusiasts mourning the impending loss of Pacer trains from Britain’s railway could get the chance to spend the night sleeping in one of their 40-year-old carriages.

After more than three decades of service, the trains are being phased out this year as new and refurbished rolling stock is brought into use.

A competition has been launched by the Department for Transport to renovate a Pacer carriage so it can continue to serve communities.

The department expects possible entries to include a hotel, microbrewery, cafe and village hall.

Rail Minister Andrew Jones said: “Through this competition we can ensure that the Pacer can be transformed to serve a community near where it carried passengers in an entirely different way.

“What we need now are creative and exciting proposals from the public, alongside ideas from businesses keen to support this competition.”

Pacer trains were built in the 1980s by mounting an old bus frame onto train wheels.

They were only intended as a short-term solution to rolling stock shortages on mainly rural routes, but have been used to serve busy commuter towns and cities.

More than 100 of the trains are still in use in northern and south-west England as well as in South Wales.

While many passengers complain they are slow, noisy and have poor suspension, some rail enthusiasts herald their low running costs and reliability.

Mr Jones described Pacers as “workhorses” but insisted they have “outstayed their welcome”.

Train operator Northern plans to retire its entire 102-strong fleet of Pacers by the end of the year.

It is introducing 101 new trains in a £500 million investment as well as receiving trains from other rail firms.

Northern managing director David Brown said: “Using a Pacer as a valued community space is a very fitting way to commemorate the service they have provided since they entered service a generation ago.”