(CNN) — Perched atop a dormant volcano, Edinburgh Castle has borne witness to many events that have shaped the Scottish capital.
From war and peace with neighboring England to plague, expansion and enlightenment.
It was there at the formation of the United Kingdom in 1707, and in years to come, it may just look on at the rebirth of an independent Scotland.
For now, however, the 800-year-old fortress remains the focal point of one of the world’s most enchanting and picturesque cities.
Over two million people visit the Scottish capital every year, ensuring it ranks among the most popular destinations in the UK.
Edinburgh Castle stands proud overlooking the Scottish capital.
Odd Andersen/AFP via Getty Images
There are few cities as redolent with history as Edinburgh.
The medieval streets of its Old Town are a beguiling warren of alleys and passageways that have witnessed as much drama, history and intrigue as the castle itself.
A few hundred meters away, across Princes Street Gardens and what was once a body of fetid water known as the Nor Loch, the plush and spacious boulevards of the New Town have helped shape more recent chapters of Edinburgh’s history.
Construction of the New Town began several decades after the act of union between England and Scotland in 1707.
According to historian Michael Fry, the project was seen as a way of tackling issues like overcrowding and lack of sanitation in the Old Town.
There were also hopes that its grand ambition and bold design would renew the city.
Edinburgh was Scotland’s political center before union with England saw parliament shifted to Westminster, an arrangement Fry said had a “very depressing” affect in the beginning.
As such, “there was a conscious effort to revive the city and keep it going as a capital,” adds Fry.
In time, the New Town would become one of the key settings for the Scottish enlightenment, a period of scientific and intellectual accomplishment that was part of a wider European movement.
Prominent enlightenment figures such as economist Adam Smith, often labeled the father of capitalism, and philosopher David Hume would meet and spend time in establishments across the city.
Poet Robert Burns, geologist James Hutton, writer Walter Scott and chemist Joseph Black were among others present during this period.
As Fry posits, if Edinburgh could no longer be a political capital after union with England then it certainly became an intellectual capital.
Several walking tours today bring visitors to the key sites where enlightenment figures would live, gather and debate the issues of their day.
A monument to the philosopher and mathematician Dugald Stewart, meanwhile, sits atop Calton Hill and offers beautiful views across the center of the city.
Edinburgh has been designated the world’s first UNESCO City of Literature.
Jeff J Mitchell/Getty Images
Edinburgh remains a seat of prominent cultural significance.
Every summer, the city welcomes artists, musicians, comedians and theater productions from far and wide to the Edinburgh International Festival and The Fringe, the world’s largest arts festival.
It’s also been home to some of most acclaimed authors and was recognized as the world’s first UNESCO City of Literature.
J.K. Rowling famously wrote the Harry Potter series in the city, drawing inspiration from its brooding architecture and gothic graveyards.
Ian Rankin is another famed Scottish writer who has explored the city through the eyes of his recurring protagonist, Inspector Rebus.
He believes that while every culture has its darker aspects, these are “not always easy to see” most of the time.
In Edinburgh, however, “the Jekyll and the Hyde” are right next to each other in the shape of the “haphazard, chaotic, mazy” Old Town and the “beautifully geometric” New Town.
Between these two, “you’ve got reason and (the) irrational,” he tells CNN.
Although born in the village of Cardenden, around 25 miles north of Edinburgh, Rankin has called the city home since his university days.
He says he’s always been intrigued by what lies just beneath the surface, beyond the bagpipes, tartan and museums many tourists associate with Edinburgh.
Rankin’s character Rebus explores the seedier side of the city in search of answers to often gruesome crimes.
Curious visitors can find many of the locations described by the author hidden away from the well-trodden tourist trail.
While Edinburgh is a small city that could be walked in a day, Rankin maintains it would take “a lifetime to get to know it.”
Even for an old hand like himself, “you might go down an alleyway, a close that you’d never been down before and that might lead you to a smaller close.
“And before you know it, you’re exploring a very different part of Edinburgh,” he adds.
Support for Scottish independence has risen since the 2014 referendum.
Lesley Martin/AFP via Getty Images
True to its nature, Edinburgh remains a city of contrasts today.
The Old Town upholds its higgledy-piggledy charm, even as the city around it continues to change.
Recent years have seen the introduction of a modern tram system that stretches all the way from the city center out to Edinburgh Airport.
The Scottish Parliament, meanwhile, is now firmly part of the furniture, legislating on issues devolved from Westminster since 1999.
The push towards Scottish independence, which was rejected in a 2014 referendum, continues in the wake of Brexit, with recent opinion polls showing a small majority in favor of breaking away from the rest of the UK.
Flag waving independence supporters have marched through the city to demand another say on the constitutional question.
But plenty of others remain committed to the continuation of the union, even if they don’t take to the streets quite so often to say so.
In the years to come, this debate could be the background setting for the next great Edinburgh writer, poet or historical development.
Whatever the outcome, Edinburgh Castle will be there to see it through.