Historic Scotland sent out a tweet on Friday warning about the presence of the mammal at the ruined 16th century castle in South Lanarkshire.
The tunnel was shut at around midday on Thursday after staff discovered the unexpected guest.
Staff were trying to persuade the badger to come out with cat food and honey after becoming aware that something was amiss when there was dug-out earth that wasn’t normal on Wednesday evening. They later saw the badger on closer inspection.
There was no indication as to why it was angry.
It was only on Saturday morning that the badger had decided to move from the tunnel the castle’s team having investigated the tunnel with a GoPro camera. The animal is said to have caused some mess, digging up through loose soil into stonework.
The rest of the castle remained open throughout and over the weekend.
The Historic Scotland property, managed by Historic Environment Scotland (HES), was built around 1530 and has a tower house, ramparts and caponier - a stone-vaulted shooting gallery.