Edinburgh Castle sits on top of a volcanic plug of rock
Edinburgh Castle was the most popular paid for visitor attraction in Scotland last year, new figures reveal.
The castle welcomed 1,196,481 visitors through its doors in 2009, a 6% increase on the previous year.
Stirling Castle was the second most popular paid for attraction, drawing 383,293 visitors, an increase of 2%.
Kelvingrove Art Gallery and Museum in Glasgow was the most visited free attraction in Scotland, with 1,368,096 people passing through the doors.
But this represented a drop of 5.3% on the previous year.
Both Edinburgh and Stirling Castles - along with Urquhart Castle, on the banks of Loch Ness, which was the third most visited paid attraction with 282,203 people - are run by Historic Scotland.
Stephen Duncan, the heritage body's head of visitor services and business development, said: "The tourism industry has proven to be resilient despite the current challenges facing the global economy and Scotland remains an attractive destination to both domestic and overseas visitors, as illustrated by these figures.
"Factors such as the strength of the euro and the increased number of flight routes from European destinations have certainly been key factors in generating overseas visitors.
"Moving forward, we are aware of the continued challenges but feel optimistic about the year ahead."
In second place among the free attractions was the National Gallery Complex in Edinburgh, with 894,161 visitors, a 9% rise on the previous year.
It was followed by the National Museum of Scotland, also in the capital, which drew 589,621 people.
The Falkirk Wheel was the most popular Scottish part paying, part free attraction, drawing 476,778 people, a 4.8% decrease on 2008.
The figures were released by the Association of Leading Visitor Attractions as tourism body VisitScotland launched a £1.25m marketing campaign to attract tourists from Europe.
Denise Hill, VisitScotland's head of international marketing, said: "The campaign strikes a chord with Europeans who not only want the heritage, history and scenery, but also the feeling of connecting with the Scottish people."
The organisation said last year's campaign generated about £85m for the Scottish economy and hopes this year's will follow suit.