Image copyright Nathan Benn Image caption The caves are in the cliffs beneath the Culzean Castle

Archaeologists investigating a cave in the cliffs below Culzean Castle have discovered the remains of a medieval doorway.

The doorway had lain hidden for centuries under rocks and sand thrown up by the stormy seas.

The current Culzean Castle, which is perched on coastal cliffs near Maybole in Ayrshire, was designed by Robert Adam in the late 18th Century.

But the caves system in the cliffs goes back much further.

Image caption The medieval doorway was uncovered by National Trust for Scotland archaeologists

The latest find suggests the caves were used as storerooms for both legal and illegal merchandise in the 15th and 16th Centuries, when there was a medieval tower on the site.

At the north end of the rock that the castle sits on, below the old stables, there are two sets of caves at the bottom of the cliff.

The smaller of the two entrances faces to the north west, the other is round the corner.

It is a bigger entrance directly to the west.

NTS head of archaeology, Derek Alexander, took me into the narrow entrance, then we went through the cavern and looked out through the western entrance.

Image caption The doorway has been buried again to protect it

Mr Alexander says: "Here we are about 20 metres in and there is the remains of a stone-built doorway and it looks to date to something like the 15th or 16th Century.

"This is the time of the use of the castle as a tower house rather than the nice, fancy, picturesque Robert Adam mansion above.

"We are in the main chamber of the Stables cave and you can see there are a lot of big collapsed blocks from the roof above."

In Stables cave you are struck by the fact there are two ways in.

There is the way we have just come, through the medieval door that everyone knows about, arriving in the centre of the cave.

But then when you are there you can look straight back down the other entrance/exit towards the sea.

The entrance is about two metres wide but there is no doorway on this side.

Image caption From inside the cavern the entrance does not appear have a doorway

At least, not one you can see. So that's where they started looking.

To their surprise they found two sides of a doorway buried to a depth of about 1 metre.

The doorway is quite wide, measuring 1.1m across, and could have been secured with a draw bar.

Alongside trained archaeologists like Derek Alexander were enthusiastic volunteers such as Kirsty Kane, who was taking part in a one of the NTS's Thistle Camp residential working holidays.

She said it was "really exciting".

"We were shifting out a lot of mud and a lot of stones and then we could actually start to see the edge on the right-hand side," she says.

"We thought 'oh my god it's actually there, we've found it'."

"We were expecting it to be a lot narrower."

Image copyright UniversalImagesGroup Image caption Culzean Castle was designed by Robert Adam in the late 18th Century

The Ayrshire coast was a smuggler's paradise for centuries and according to Mr Alexander when it comes to cave doors, size does matter.

He says: "What's remarkable about this door is that it is actually a lot wider than the one in the inside there.

"I hadn't really thought it but one of our volunteers works for a whisky company and he looked at the door and said 'you could roll a barrel through that'.

"We all went 'that's probably what it is'."

Image copyright MyLoupe Image caption The Ayrshire coast was a smugglers' paradise

But here is the bad news.

Because the door can't be left exposed to the elements it has been covered over again with the same kind of sand and rocks which concealed it for centuries.

The discovery of a medieval door isn't the only evidence of how people used the caves below Culzean Castle.

Radiocarbon testing on other objects found in the neighbouring Castle Cave revealed that they were first used by humans nearly 2,000 years ago in the Iron Age.