In a “hot-mic moment” captured by Sky News in 2014, then prime minister David Cameron revealed that the Queen “purred down the line” when he told her a majority of Scots had voted against independence.

Mr Cameron privately apologised and later called the remarks “a terrible mistake”.

Yet they provided the rarest glimpse of an opinion from a monarch who spent decades treading carefully through the complexities of Scottish politics.

William, Kate, Harry and Meghan reunite in Windsor – latest updates

Fifteen years earlier in 1999, the Queen was determined to be at the heart of the ceremony to open (or as some argue “to reconvene”) the Scottish parliament.

A thistle-themed green silk dress and purple coat was specially commissioned.

More on Queen

Her speech and the presentation of a ceremonial mace was intended to be the highlight.

“This parliament has set itself many challenges”, she told the newly elected politicians.

“To be modern, not just in the use of technology but in the way it engages with the people of Scotland in a climate of openness and accessibility.”

The monarch was, yet again, not just adapting to her country’s changing constitutional position, but putting herself at its centre.

Watch Sky News live from 10am as a cortege takes the Queen’s coffin from Balmoral to Edinburgh

The New Labour years were full of upheaval in this respect, with the government devolving powers to Wales, power-sharing beginning in Northern Ireland and the removal of most hereditary peers from the House of Lords.

Later the prospect of Scottish independence posed challenges even if, under SNP plans, the Queen would remain as head of state.

These changes meant the sovereign had to modify her role.

From 1999, Scotland’s first minister would be regularly invited for confidential one-to-one audiences, but these would be shorter than those with the prime minister.

The first minister would be welcomed to Balmoral for a weekend over the summer – but just for one night unlike the two offered to the prime minister.

The Queen remained politically neutral in the 2014 independence referendum, although Mr Cameron’s remarks, plus the monarch’s comments a few days before the vote outside Crathie Kirk near Balmoral were seen by some as a sign of her views.

“Well I hope people will think very carefully about the future,” she told a well-wisher.

With Nicola Sturgeon keen to pursue a second referendum in 2024, independence remains a live constitutional issue.

King Charles knows the arguments, the personalities and the institutions.

He was wearing highland dress and a face mask in Holyrood last October as his mother opened the Scottish Parliament’s sixth session.

She spoke of the “difficult circumstances” of the pandemic, and “countless examples of resilience and goodwill”.

Her son will likely need both these qualities in navigating the challenges of Scotland’s constitutional development in the years ahead.