When the Queen made her one and only state visit to Morocco in 1980, it was dubbed the “tour from hell”.

The monarch endured a lengthy wait in a sweltering hot desert tent while the Moroccan King Hassan II vanished and went to lounge in his air-conditioned caravan.

Newspaper reports told how the Queen was “clearly very angry”, showing signs of displeasure by fidgeting with her bag and hat, and tapping her foot.

The Queen and King Hassan II
The Queen and King Hassan II of Morocco in the UK in 1987 (PA)

“Keep your cameras trained; you may see the biggest walkout of all time,” she told photographers.

Royal tours to the North African country, where the Duke and Duchess of Sussex will pay a three-day official visit on Saturday, have proved somewhat challenging over the years.

Meghan and Harry
The Duke and Duchess of Sussex will be spending three days in Morocco (Danny Lawson/PA)

The Queen’s sister Princess Margaret, reportedly warned her, saying: “Going to Morocco is rather like being kidnapped, you never know where you are going or when.”

Autocratic Hassan II, who ruled from 1961 to 1999, was extremely paranoid, having survived a number of assassination attempts, so was deliberately erratic in his movements.

He made the Queen change cars seven times on the road from Marrakesh into the foothills of the snow-capped Atlas Mountains during the trip in October 1980.

Schedules were thrown into disarray and venues were switched between the many royal palaces without notice.

At one point, the Queen arrived in full regalia for the king’s state banquet to find that the chosen palace was closed.

The Queen in her regalia
The Queen dressed for at a state banquet on tour in Kenya in 1983 (PA)

She was left waiting for nearly an hour for her host to arrive.

Meanwhile, the Duke of Edinburgh’s private secretary managed to arrange for a dry martini to be passed to the Queen through the window of her car, according to royal writer Robert Hardman.

Another time, the monarch admonished King Hassan II for blaming her then-assistant private secretary Robert Fellowes for a delayed lunch, telling him: “I’ll thank you not to speak to my staff like that.”

She also overruled him when he cancelled a visit to a British funded Leonard Cheshire centre for the disabled and tried to take her back to one of his palaces instead.

King Hassan in London
King Hassan waves at Victoria Station in London with the Queen in 1987 (PA)

“You can stop the car in that case,” the Queen remarked to the king.

“And I’ll go with my security people.”

She went ahead with the engagement on her own.

Newspaper reports at the time told how the monarch entered into a heated discussion with the king when he returned after leaving her waiting in a sweltering tent.

When he disappeared again, she gave a “resigned shrug”.

In the end, the Queen was said to have grown fond of Hassan, who recognised she was not a monarch to be messed with.

She sent him a letter afterwards praising his warm and generous hospitality.

The tour had been anything but dull, provided anecdotes for years and “in a funny sort of way, it was good fun”, a member of the Queen’s team told Hardman.

King Hassan and the Queen at Windsor
King Hassan greets the Queen at the Sovereigns Entrance to Windsor Castle in 1987 (PA)

The king was later invited to make a return state visit to the UK in 1987.

He arrived with an 180-person entourage, and also brought along his own bed.

The Prince of Wales has made several visits to Morocco, and a trip in 1996 was described as something of “mystery tour”.

True to form, Hassan changed the prince’s programme at the last minute.

Charles in Morocco in 1966
The Prince of Wales takes a tour of the Al Akhawayn University at Ifrane, Morocco in 1996 (John Stillwell/PA)

A planned audience at a palace in Morocco’s capital Rabat was switched to a hunting lodge 40 miles away.

Apparently, the king had spent the previous day hunting wild boar, and decreed that the British heir to the throne should join him for lunch in the country.

The detour caused havoc with the prince’s schedule and he arrived an hour late for his next engagement.

Charles in Morocco in 1995
The Prince of Wales meets stallholders as he tours the Medina of Fez, Morocco on another trip in 1995 (Martin Keene/PA)

King Hassan died in 1999, and was succeeded by his son King Mohammed VI.

Charles made another visit in 2011, with the Duchess of Cornwall, which went much more smoothly, despite coming in the wake of unrest in North African states.

Charles and Camilla in Morocco
The Prince of Wales and the Duchess of Cornwall during a tour of the Kasbah des Oudaias in Rabat, Morocco in 2011 (Chris Radburn/PA)

The trip to Rabat and Fez, among others, focused on multi-faith issues, climate change and trade, but a visit by the prince to the Sahara Desert did have to be abandoned due to sandstorms.