Edinburgh Castle has broken through the two million visitors barrier for the first time as record numbers flocked to historic sites across the country. 

The busiest "paid-for" attraction in Scotland has reported a 15 per cent increase in ticket sales in 12 months. 

More than 800,000 more visitors are flocking to the landmark now than five years ago. 

The heritage agency responsible for the castle has cited the hit TV show Outlander, set and filmed in Scotland, as a contributing factor to the increase. 

READ MORE: 7 hidden Edinburgh gems you may not have known about

It is also thought that increased numbers of overseas visitors coming to the UK are a result of the weaker pound ahead of Brexit

Visitor numbers have soared at Edinburgh Castle every year since 2012 when they were badly affected by the London Olympics. 

A 13 per cent increase was recorded between 2015 and 2016. 

Reaching two million visitors could propel the castle into the league table of Britain's top ten attractions. 

It would go alongside the likes of the British Museum, Tate Modern, the National Gallery and the Natural History Museum. 

The National Museum of Scotland, a largely free attraction, said in mid-November it had attracted two million visitors for the first time. 

READ MORE: 7 hidden Edinburgh gems you may not have known about

Historic Environment Scotland (HES) also revealed all ten of its most popular sites, including Stirling, Urquhart, Doune and St Andrews castles, have also had record years. 

It said there was growing interest from around the world in sites with links to iconic figures from Scottish history such as Robert the Bruce, Mary, Queen of Scots and the Stuart kings. 

Edinburgh Castle staged a major exhibition on Bonnie Prince Charlie and the Jacobites this year. 

It offered the first chance for visitors to catch a glimpse of the "Galloway Hoard," Britain's single biggest discovery of Viking treasures, during a £2 million fundraising campaign to secure them for the nation. 

Stephen Duncan, director of commercial and tourism at HES, said: "The Year of Heritage, History and Archaeology has given us a fantastic platform to highlight Scotland's historic environment. 

READ MORE: 7 hidden Edinburgh gems you may not have known about

"The connections of the castle to Robert the Bruce, the Stuart Kings and Mary, Queen of Scots and the impact of dramatisations such as Outlander illustrate a long and romantic history, which attracts visitors from home and abroad. 

"Globally, we've seen more visitors arriving in Britain and Edinburgh thanks to the strength of our air connections to other countries. 

"Many of these visitors will have chosen to visit Edinburgh Castle due to its place as an international symbol of the city and of Scotland. 

"We've seen a record-breaking summer for our sites across Scotland, which saw our ten most-visited sites - including Urquhart Castle and Skara Brae - record their busiest ever seasons, with Stirling Castle recently welcoming its 500,000th visitor of 2017." 

Malcolm Roughead, chief executive of VisitScotland, said: "Edinburgh Castle is one of the most awe-inspiring landmarks in the world. 

"Sat high up on volcanic rock overlooking Edinburgh in all its magnificence, it is no surprise that it has broken through the two million visitor mark. 

"In our recent survey, Edinburgh Castle was voted the best castle in Scotland by the British public and I'm not surprised at all. 

"I hope that visitors keep on exploring Scotland's fascinating heritage into 2018 and beyond." 

The castle's record visitor numbers cover the period from January 1 to Christmas Eve.