A family was relieved when their dog scrambled out of a badger sett in Northampton after camping by the entrance overnight as it got stuck inside.
Barney was unharmed after more than 12 hours in the live sett in woodland in Wootton from Sunday afternoon (March 7) to Monday morning.
The pet escaped just as representatives from the RSPCA and Northamptonshire Badger Group were leaving, with the intention to get firefighters to dig him out the next day if need be.
Sally Jones from the badger group said: "It was a bit of a stressful situation as I completely understood, their pet dog who they love immensely has gone down and they were very worried about it.
"But I've got to think about the badgers as it's their home and they're just living their lives and there may have been cubs in there so I'm trying to make the best outcome for everyone involved.
"It was really good partnership working from local organisations and the owners were fantastic in dealing with it so it was a really good outcome."
The family were walking with Barney in the woods near Wooldale Road when the dog got stuck in the hole at around 8pm.
They called Northamptonshire Fire and Rescue Service who contacted the badger group to get advice and to find out if they knew of any setts in the area.
She did not but she recommended the owners stay with the dog, continually call down to it and have something it can smell at the entrance like themselves, a toy or food.
"People in our group have known dogs who have been in setts for a week or more and I've been in a situation when the dog was never found after going down one," she added.
The owners ended up sleeping there and Sally visited in the morning to ascertain whether or not it was a live sett or not.
Live badger setts are protected by law and this time of year is when cubs are born so Sally was particularly concerned about disturbing them.
She confirmed the sett had signs of current use as there was fur, footprints, claw marks and well-worn paths around the hole, which she believes was created by the developers of the nearby houses.
Sally liaised with Natural England to get a licence to put a camera down the sett to find Barney, who they could hear inside so he could not have been too deep, and potentially dig him out.
They decided to wait another 24 hours before getting the shovels out and just as she and her RSPCA colleague were leaving, the dog managed to get himself out.
Sally said: "The owners liaised with all the right people and did all the right things and we had a good outcome.
"The worst thing to do is to dig into the sett and come across angry badgers and cubs a month old who could have perished which would have been awful."
A Northamptonshire Fire and Rescue Service spokesperson said: “An appliance from Mereway was called at 8.12pm on Sunday (March 7) to assist with the search of a dog that was trapped down an animal hole.
"The crew arrived at the scene, at Wooldale Road in Wootton, and used cameras and lighting to try and help the dog escape.
"We are delighted the dog has since been safely recovered.”