TV presenter Sir Tony Robinson and experts from hit show Time Team have visited Lincoln Castle to film a programme exposing the horrors of punishment at the site.
Channel 4 said the episode, to be aired tonight (Sunday), will reveal a brutal Victorian "experiment" that pushed prisoners "to their limits".
The team visited the city during archaeological digging for the £19.9 million Lincoln Castle Revealed project, which will see the creation of a purpose-built Magna Carta centre.
With help from Phil Harding and Alex Langlands, Sir Tony will trace the story of punishment over the course 1,000 years.
The castle was used as a Victorian jail and is still home to Lincoln Crown Court.
An online advert for the episode said: "Some went mad, many died, and the prison regime broke down in shocking circumstances.
"In this grim jail in the heart of the city, something went badly wrong."