Wightwick Hall was built at Swindon Works in 1948 and was withdrawn from service in 1964.

But it was salvaged from a scrapyard in Barry Island, South Wales, in 1978, and volunteers have been restoring it at the railway centre near the village of Quainton.

It has just finished filming scenes for the Harry Potter series, due for release in 2027, at the Windsor Estate in Berkshire.

“These are very expensive machines to put back together again and it took tens of years to do it,” explained John Hatton, who helped raise funds for the restoration.

He said it costs in the region of £300,000, every 10 years, to keep it on the tracks.