Fifty-one visitors have been freed after being trapped in a "fairytale" castle when the drawbridge collapsed.
South Wales Fire Service was called to Castell Coch in Tongwynlais near Cardiff at 1400 BST on Wednesday.
A crane was trying to get into the castle to carry out maintenance when the drawbridge collapsed under it.
The custodian kept those stranded entertained with a sword-fighting demonstration until the fire service was able to make safe an exit route.
Cadw, which manages the building and promotes it as a "late 19th Century fairytale-style castle," said they were freed by 1700 BST.
The "cherry picker" crane, which weighs 2.9 tonnes, caused the drawbridge to tilt sharply, trapping the picker against the wall.
No-one was believed to have been injured in the incident. The castle re-opened on Thursday.
Before the visitors were released, the Cadw spokeswoman had said: "A cherry picker undertaking routine maintenance on roof tiles at Castell Coch has unfortunately caused damage to the castle's drawbridge.
"This in turn has led to a number of visitors within the castle being unable to leave via the drawbridge exit."
She added: "Castell Coch will now be closed until further notice to undertake urgent repairs on the drawbridge".
Castell Coch (which means Red Castle in Welsh) was built in the late 19th Century for the third Marquess of Bute by the architect William Burges.
It includes features of medieval style castles, and took 16 years to build, with work beginning in 1875.
It stands on the site of a Norman motte and bailey castle, which was later rebuilt in stone in the 13th Century but fell into ruin after it suffered serious damage soon afterwards.