A team of rail workers have discovered a small cave believed to be from the 14th century.
Engineers were fixing a landslip near Guildford in Surrey when they found the suspected medieval shrine.
Archaeologists believe it may be linked to the Chapel of St Catherine, the ruins of which are on a nearby hill.
The cave is made up of several sections between 30cm and 70cm high but may have been much larger in the past.
Inside, experts found evidence of writing and other markings in the ceiling.
The cave roof is covered in black dust, thought to be soot from lamps, and the remains of two firepits were also spotted.
A spokesman from Archaeology South East said: “The cave contained what appear to be shrines or decorative niches, together with carved initials and other markings.
“The old name for St Catherine’s Hill is Drakehull ‘The Hill of the Dragon’, so this has obviously been a site of ritual significance long before the construction of the church on the top of the hill in the late 13th century.
“Work is under way to analyse soot and charcoal found inside the cave, which will hopefully tell us more about how and when it was used.”
Mark Killick, Network Rail Wessex route director, said: “This is an unexpected and fascinating discovery that helps to visualise and understand the rich history of the area.
“A full and detailed record of the cave has been made and every effort will be made to preserve elements where possible during the regrading of the delicate and vulnerable sandstone cutting.”