ON the edge of the Dalmeny Estate overlooking the Firth of Forth, Barnbougle Castle cuts a striking silhouette against the skyline. Once the secluded bolthole for a Victorian prime minister, it has been mothballed for close to a century.

But it has newly opened to the public for the first time, available to hire for weddings, gala dinners and private parties. Owned by the Primrose family, the Earls of Rosebery, for almost 400 years, the castle has been painstakingly and meticulously restored.

The refurbishment was led by Harry Primrose, Lord Dalmeny – the chairman of the auction house Sotheby's in London – and his sister, Lady Jane Kaplan, a retired lawyer who also co-runs Great British Vermouth which is hand-produced in small batches on the estate near South Queensferry.

Barnbougle Castle had been a cherished retreat for their great grandfather Archibald Primrose, the 5th Earl of Rosebery, who was twice foreign secretary and briefly prime minister, succeeding William Gladstone in 1894.

After his death in 1929, the castle lay dormant. "It was closed up and left almost exactly as if he'd walked out," says Lady Jane. "There were still his papers all over the tables."

Among the family, the building was fondly regarded as their great grandfather's "shed at the bottom of the garden". A live-in caretaker kept the place ticking over. "We didn't actually do anything with the castle apart from store surplus bits of furniture in it," recalls Lady Jane.

When Barnbougle was ravaged by a storm in 2010, badly damaging the terrace and balustrade, it provided an unexpected opportunity for a rethink. "We were checking over the castle and realised the roof was in a bad way and beginning to leak," says Lady Jane.

"We needed to spend a lot of money to keep it going so we had a good think about what we could do with it rather than keeping it as a furniture store. We didn't want to ruin the spirit of it. We wanted to use it in a way that wouldn't have my great grandfather spinning in his grave."

Lady Jane took on the mantle of project manager. "The brief was to 'change everything but change nothing'. The castle needed re-wiring and safety measures added such as sprinklers and smoke detectors, but it all had to be done without them being visible.

"We were trying to make the rooms remain as if he – my great grandfather – had only just walked out. We were very careful to match the colours. The main banqueting hall is a terracotta colour and we took scrapings from behind the paintings where the paint wasn't quite as faded.

"It took about 40 attempts to get a match. The paint firm Craig & Rose were marvellous because they came and tried very hard until we got something that we felt was an exact match for the original paint colour.

"The former caretaker's flat was in the part that has been turned into the catering kitchens and the public loos which is great because it has meant we haven't had to change the old bits of the castle."

The history of Barnbougle Castle is fascinating. There has been a building here dating back to the 13th century when the original tower house was used to protect the Moubray family from their enemies and reputedly became a smuggling hub.

It was bought by Sir Archibald Primrose, father of the 1st Earl of Rosebery, in 1662 to be used as the family home. Cold, damp and draughty, the final straw, says Lady Jane, came when a great wave extinguished the dining room candles at Barnbougle, prompting the 4th Earl to build nearby Dalmeny House in 1817.

Afterwards, Barnbougle was used to store explosives. "Whether it was by accident or by design, the old castle was blown up," says Lady Jane. "There was just one corner, one sidewall and a tower remaining.

"It stayed pretty much as a ruin from 1819 through to 1881 when the 5th Earl, my great grandfather, rebuilt it. He was planning to tear it down because he thought it was unsafe, but it is on a rocky promontory and gives a very good guide to shipping.

"At that time, he was foreign secretary and married with two – soon to be four – small children. I think what he was looking for was somewhere he could get some work done. Barnbougle was rebuilt with six libraries and one bedroom.

"When his wife died in 1890, my great grandfather became an insomniac. Barnbougle was the one place he could get a good night's sleep. It was the sound of the sea. The bedroom has got windows that face in two directions – a bit like being in a ship's cabin."

The castle's charms include a 60ft-long banqueting hall with a gallery at one end which her great grandfather used for practising his speeches. There are six libraries, including the Scottish Library, which houses sections on the nation's history, poetry and sport among others.

"He was a voracious buyer of books," says Lady Jane. "The caretaker would dust them once a year. As part of the restoration, I dusted all the books. Once I got above 10,000, I stopped counting."

The 5th Earl and his wife, Hannah de Rothschild, collected paintings, furniture, silver and objects of curiosity, ranging from African spears to Robert Burns' candlesticks and Prince Charles Edward Stuart's pistols. These have all been catalogued and put in storage for the time being.

Barnbougle has treasures aplenty with many of the original furnishings and ancestral portraits remaining in situ alongside stunning architectural detail such as crowstep gables, crenellated parapets, a stone spiral staircase and marble sea-water bath.

There are two large event spaces catering for up to 200 guests. Groups of up to 450 people can be accommodated with the option of marquees in the garden.

Lady Jane is keen to stress the renovations have been very much a family project with her sisters and brother Lord Harry all mucking in.

"My elder sister Lucy and my middle sister Emma were both a tremendous help with colours, light fittings and the decorative details like that. My younger sister Caroline is a banker and she is a great help in making sure we don't spend more than we intended to."

Their parents got their sleeves rolled up too. "My father was out on the building site most days when the conversion was going on," says Lady Jane. "He was extremely involved.

"We had to get new high voltage electricity cables, so he oversaw digging a trench from Dalmeny House down about 600 metres along the golf course and across to the castle. He was there every day in the trench.

"Everything had to be moved out of the castle and into the main house. All the paintings, furniture and china as well as some of the books. My mother helped with the cataloguing, the packing and the unpacking. Then, of course, it all had to come back down to the castle again afterwards."

Lady Jane's father Neil Primrose, the 7th Earl of Rosebery, had his 90th birthday party at Barnbougle Castle earlier this year, the first event to be held there for more than 90 years.

The family hope it will play host to many other happy occasions. "It is the most wonderful, atmospheric and romantic place," says Lady Jane. "Whatever the weather, it has the most glorious atmosphere.

"I'm quite partial to it because I got married in our local church at Dalmeny and then had a tent outside the castle, so it has got special memories for me. We couldn't use the castle as a venue in those days because it was still being used for storage. That was 30 years ago.

"Now you can have a wedding inside and roll back the carpet in the banqueting hall for dancing. There are so many different options for photo opportunities. You are right on the edge of the Forth, so the views are spectacular. Even if it is dreich, the castle looks dramatic in the mist."

Wedding packages start from £115pp; the castle facility fee costs £7,200. Visit roseberyvenues.co.uk