Planned with military precision, it was to be a royal event unlike any the Scottish capital had seen before, packed with ceremony, celebration and crowds.

The youthful Queen Victoria and her consort Prince Albert were set to unleash royal-mania on Scotland with their first ever visit, and Edinburgh’s city fathers had prepared the most spectacular of welcomes.

The royal visit of 1842, however, would not meet the inch-perfect precision and fine attention to detail that was achieved during the Duke of Edinburgh’s recent funeral – or, to be fair – most other state occasions.

Instead, Queen Victoria’s first impressions of a Scottish welcome would be one of utter chaos, confusion and a comedy of errors – from dignitaries missing her arrival to a fatal scaffold collapse – all of which would leave Edinburgh’s great and good with egg on their faces.

Despite the rocky start, the royal visit sparked a love affair for Scotland that would span the generations to today’s royal family.

While Victoria and Albert’s travels around Scotland and beyond would be captured by leading watercolour artists of the day, sorted into ‘holiday’ albums and revisited time and again, reviving memories of the places they visited.

Now watercolours depicting their Scottish visits are among more than 80 works to be showcased in a major exhibition at the Queen’s Gallery at the Palace of Holyroodhouse.

They include a vibrant watercolour showing Edinburgh at sunset by Dunfermline-born painter Waller Hugh Paton, commissioned by Victoria to capture a favourite view of the city.

Another by Glaswegian artist William Simpson shows Victoria unveiling of the memorial to Albert in Charlotte Square in 1876.

Being shown for the first time is a particularly atmospheric work by self-taught Glaswegian artist William Leighton Leitch, showing the royal party’s arrival at Granton Pier in late summer 1842.

But while it illustrates a blustery scene of little vessels battling choppy waters to make it to harbour, it only tells part of what turned out to be a rather hair-raising royal arrival.

Just five years into her reign, the young queen had been enchanted by Sir Walter Scott’s novels and, keen to provide the warmest of Scottish welcomes, Edinburgh’s great and good spent months – and significant expense – preparing what was to have been the grandest of welcomes.

Bonfires were to be lit on the summit of hills from the Pentlands to the Lomond Hills in Fife to greet the royal yacht, HMY Royal George, on its elegant journey up the Firth of Forth.

In Edinburgh, towering scaffolds were erected with seats for thousands of excited citizens who had paid handsomely for tickets that guaranteed the perfect vantage point. The royal carriage was to make its way from Granton, accompanied by city leaders, towards the Palace of Holyroodhouse where the state rooms had been “profusely decorated”, according to one newspaper report of the time.

And although a suggestion that every citizen wear blue coats with yellow buttons and favours of Victoria tartan was largely dismissed, news of the visit sparked a rush for new outfits, with one weaver said to be wrestling with orders for enough Breadalbane tartan to equip 200, and a large quantity of Drummond tartan.

“I order to accomplish this object, the shuttles in the looms are flying at almost railway speed,” the report added.

It all started to go wrong when it emerged the royal yacht was running behind schedule. Tens of thousands who had made the journey to the city via the newly opened Edinburgh to Glasgow railway, by carriage and cart, were sent home disappointed and told the visit would begin at around 11am next day.

However, blustery east coast winds powered the royal yacht to her destination faster than expected. Indeed, the queen would step onto Scottish soil three hours earlier than predicted.

And arrangements for the welcoming ceremony fell into total disarray as local dignitaries, organisations, military and tens of thousands of well-wishers suddenly found the royal visit was taking place without them.

As the queen’s carriage meandered through surprisingly quiet streets, signals were frantically exchanged and flags raised in a desperate attempt to raise the alarm.

While in her wake, the parade of carriages which should have been filled with smartly dressed city leaders was made up of oddball carriages and carts containing rather bemused locals.

Even the Royal Archers, the queen’s bodyguard, was in a flap. Having been ordered to rush to Granton, they met Victoria’s procession coming in the opposite direction. As confusion reigned, they were mistaken as possible assassins and forced to explain what they were doing.

Having established they were not there to kill the queen, the flustered bodyguard then tried to join the parade, however the royal carriage was apparently moving so fast that instead of smartly marching alongside, they had to speed up to double quick time to keep up.

Elsewhere, the Lord Provost, magistrates and councillors were engulfed in confusion, arriving at locations where ceremonial welcomes had been planned, only to see Victoria’s carriage disappear in a cloud of dust.

Worse, plans for the royals to stay at Holyroodhouse were scrapped due to an outbreak of scarlet fever and – perhaps even more troubling – pools of raw sewage that had appeared around its walls.

Instead, the royals bashed on to Dalkeith Palace, followed eventually by very red-faced city leaders. Having apologised profusely to the queen, they then faced the wrath of citizens furious at missing not one, but two opportunities to cheer the royal party.

The situation became disastrous when it emerged that a stand erected to provide vantage point collapsed, leaving two dead and around 50 people injured.

Insults and criticism of the city’s Lord Provost, James Forrest, and Edinburgh’s bailies followed, including songs poking fun at their tardiness. One, Jemmie Forrest, sung to the tune Johnnie Cope, included the line: “Hey, Jemmie Forrest are ye waukin’ yet or are your bailies snoring yet?”

The exhibition of watercolours includes views of the cities and landscapes the couple saw on their travels along with moments of significance, such as christenings, birthday parties and glittering balls.

According to the Royal Collection Trust: “The royal couple spent happy evenings together organising their watercolours into albums.

“Following Albert’s death in 1861, the albums took on even greater significance to the widowed Victoria, functioning as both a tangible memory of the time spent with her beloved husband creating them and a visual record of their lives together.”

Despite the unfortunate welcome to Scotland, the young queen was enamoured by the city. The tour sparked a love that culminated in the building of the couple’s private Highland residence, Balmoral.

She wrote afterwards: “Edinburgh made a great impression upon us; it is quite beautiful & totally unlike anything I have seen”.

Victoria & Albert: Our Lives in Watercolour is at The Queen’s Gallery, Palace of Holyroodhouse from April 26 to October 3