In a corner of Edinburgh, outside the Palace of Holyroodhouse with its witches’ hat towers and crenellated turrets, 74-year-old tour guide Kenny Hanley can often be found pointing to a little piece of magic atop an ornamental gateway at the residence’s southern approach.

The focus of his attention is an almost-forgotten stone emblem of the city and country in which he lives, and yet few realise it’s one that teems with meaning, telling an almost unbelievable story about Scotland’s national identity.

It tells an almost unbelievable story about Scotland’s national identity

Take a step back, and the fuller picture emerges. There’s a second cast-stone figure opposite – a rampant lion, crowned, and holding a ceremonial flag as it stands guard. But Hanley’s gaze remains drawn to the slender, mythical creature wrapped in chains to our right.

The stone is just stone and the lion is just a lion, but this horse-like figure – adorned with a singularly fancy horn on its forehead – is extraordinary. It is a unicorn. And, believe the hype or not, it is Scotland’s national animal.

You may also be interested in:
• Why Scotland loves haggis
• Why Icelanders believe in elves
• The last guardians of a python spirit

Until recently, all talk of unicorns belonged in the glitteriest corner of a children’s playroom. Or on a rainbow-coloured cereal box. It’s a subject rarely cerebral enough to merit debate, but these days, wide-eyed unicorns are everywhere.

From cartoons and movies to fashion and social media, they have a bigger role to play in the public consciousness than ever before. To cap it all, there’s now a National Unicorn Day on 9 April. Hashtag #NationalUnicornDay on Instagram and you’ll find yourself entering a world of sparkly cupcakes and multi-coloured memes. Amid this, let’s not forget JK Rowling’s Harry Potter, inspired by many real places in Edinburgh and brimming with stories of magical unicorn blood and unicorn hair-infused wands.

Not that any of that matters to Hanley, who saw his first unicorn more than 60 years ago, when growing up in the city’s Canongate district near the Palace of Holyroodhouse.

“It’s long been a symbol of purity and power, but also of virginity and subtlety,” said Hanley, who works as a Blue Badge guide for the Scottish Tourist Guides Association. “And those values still stand up when thinking about Scotland today. These are characteristics embedded in the Scottish psyche.”

In most countries, the national animal is little more than a consequence of natural history or geography. Australia’s is the red kangaroo and South Africa’s is the springbok. Spain has the bull, while India venerates the Royal Bengal tiger. Canada celebrates the North American beaver, Russia the Eurasian brown bear. Indonesia? The Komodo dragon. Afghanistan? The snow leopard. Scotland? Well, theirs is more in keeping with a once-upon-a-time world.

To the outsider, this all may seem absurd. Yet today there are dozens of places to see the pure-white, mythical horse of fairy tales at large in Edinburgh ­– and across all of Scotland. Blurring the boundaries between fantasy and reality, you can see reminders of its influence on heraldic crests, engravings, gold coins, royal seals, wall panels, coats of arms, tombs and tapestries.

It’s long been a symbol of purity and power

At the Palace of Holyroodhouse, Edinburgh Castle, Craigmillar Castle and St Giles’ Cathedral, all in Edinburgh, unicorns are ubiquitous. Move west to Linlithgow Palace, the birthplace of Mary Queen of Scots, and there are well-preserved unicorns on an inner courtyard fountain and on what remains of the ceiling. Veer north-west to Stirling Castle and the mythical beast is the focus of the intricate Stirling Tapestries, seven hand-woven recreations of ‘The Unicorn Tapestries’ (one of the most valuable artworks of the late Middle Ages; the originals are now on display at the The Met Cloisters in New York).

And from Aberdeenshire’s Delgatie Castle to Dundee’s HMS Unicorn (Scotland’s oldest surviving wooden warship), via the mercat (or market) crosses of Prestonpans and Glasgow, there are a multitude of cloven-hooved unicorns, crowned at the throat and holding royal cartouches.

As a unicorn newbie, I really had no idea where to begin. But the company of one of Scotland’s leading tour guides was as good a place to start as any.

“Everywhere you go in Scotland you can see them,” Hanley told me. “You just need to know where to look. Today, people read history through a 21st-Century lens – be it social media or whatever – and we miss the bigger picture as to how this all came together. Yet there’s a definite thread to follow. The unicorn is a symbol built on an ideology, and learning about it opens doors and surprises you. Even I find it almost unexplainable at times.”

This enigmatic creature has an equally complex and convoluted history that spans some 3,000 years. Considered real by the Ancient Greeks, the horse-like quadrupeds were first mentioned in the 4th Century BC by classical historian Ctesias in Indica, a book on India in which he describes the creature as a ‘wild ass’ with a horn sprouting from its temple.

Belief spread when the unicorn popped up in the Old Testament and references to mythical horses occurred in the Quran (the appearances of which are still wildly debated today), while the existence of other peculiar-looking, flesh-and-blood creatures, such as the rhinoceros, the oryx and the narwhal, did little to dispel the myth. One theory suggests unicorns were flushed off the face of the Earth because they were simply too slow to get onto Noah’s Ark before the flood.

Over time, the creature came to represent Jesus Christ, while others believed it could only be tamed by virgins. By the 12th Century, the unicorn had made its first appearance in Scotland, placed on the royal coat of arms by William I (also known as William the Lion).

According to the National Museum of Scotland, medieval legend further suggests only a king could hold a unicorn captive because of the supposed danger it posed, something that may have given rise to its widespread adoption. What is known is James II wholeheartedly embraced the legend, and the unicorn became the symbol of purity and power that Scottish kings and nobility identified with in the 15th Century. Over time, this led to the unicorn becoming officially recognised as Scotland’s national animal.

What started with James II flourished through a succession of his ancestors – notably James III, James IV and his grandson James V – who ensured its appearance on coins, royal seals and coats of arms. Indeed, the Royal Coat of Arms of Scotland, used prior to 1603 before the Union of the Crowns (the accession of James VI of Scotland to the thrones of England and Ireland), was supported by not one, but two unicorns.

Despite such evocative history, the mythical beast remains misunderstood, at least according to one fervent Scottish believer. Liam Devlin is Scotland’s official Unicorn Pursuivant, a badge of office for the Court of the Lord Lyon, which helps bring order to matters of Scottish heraldry. Devlin, now in his fourth year in the role, believes the unicorn’s true meaning is getting lost in metaphor.

“Its significance is being damaged by politicians [around the world, particularly when it comes to Brexit] who use it as an image of uncertainty and fanciful thinking,” said Devlin, who is also a Knight of Malta and a member of The Heraldry Society of Scotland. “Some Scottish nationalists also think the unicorn’s chains symbolise our subjugation from England. But that’s nonsense. The chains predate the Acts of Union in 1707 [that led to the creation of the United Kingdom of Great Britain] and show the savage nature of the beast – it is not My Little Pony with a horn. So it would be good to administer a history lesson to these unpatriotic politicians.”

Everywhere you go in Scotland you can see them – you just need to know where to look

For the best part of three decades, another Scot, 72-year-old John Donaldson, has worked to bring unicorns back into the national conversation through art. The self-taught woodcarver has added to the architectural and heraldic legacy of the country in a way that no-one else has – and his works are beyond staggering.

In particular, Donaldson worked with Historic Environment Scotland on the seven-year refurbishment of Stirling Castle, recreating the magnificent Stirling Heads – 16th-Century oak medallions carved with images of kings, queens and nobles – as well as a 1.8m by 1.2m ceiling boss of King James V’s crest and coat of arms for the King’s Bed Chamber. Unicorns, of course, are front and centre.

“It’ll be on the ceiling for hundreds of years and it’s a great legacy to leave behind for Scotland,” he told me. “This story shouldn’t be relegated to our past, because it’s a distinct part of our heritage, and our past is our future. People come here to see history, and whether that’s castles or unicorns, it’s a major attraction and part of our national fabric. It’s who we are.”

So, should you visit Stirling Castle or stand gazing upon a mercat cross, you may find yourself pointing to a little piece of magic, too. And amid the reality – maybe, just maybe – you might see the unicorn, Scotland’s venerated animal, in a whole different light.

Join more than three million BBC Travel fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Culture, Capital and Travel, delivered to your inbox every Friday.