Image copyright Getty Images Image caption George Osborne was keen to use Xi Jinping's state visit to bolster UK-China trade ties

A state visit is the ultimate weapon of British diplomacy, the bunker buster of soft power that can break down the hardest of tyrannical hearts.

Few world leaders can resist the siren lure of all that royal bling: horse-drawn coaches, state banquets, processions down the Mall, the sheer scale of all that gold leaf and pomp and flummery that allows them a brief window into a royal fantasy that many countries envy but can rarely match.

This weapon is deployed sparingly, normally no more than twice a year. But it does get used.

If Donald Trump does touch down for a little red carpet treatment later this year, it will be the 110th time the Queen has welcomed another head of state to these shores in her reign.

And for now, despite the protests and growing online petition, Downing Street is continuing to stand firm, insisting that the invitation to the president stands.

Political and purposeful

So state visits are not merely ceremonial affairs, they are political and purposeful. They are used by the British government of the day to further what they see as Britain's national interests.

In 1973, the Queen welcomed President Mobutu of what was then called Zaire in Africa, now the Democratic Republic of Congo.

He was a brutal, corrupt dictator but he was also seen as a vital anti-communist ally in the Cold War against the Soviet Union. So he got an invite to the Palace.

Image copyright Getty Images Image caption President Mobutu's 1973 visit was extremely controversial

President Suharto of Indonesia, another repressive leader who happened to be anti-communist, was also granted a state visit in 1979 for the same reasons.

In 1971, Emperor Hirohito of Japan was welcomed by the Queen for a state visit as a deliberate attempt to help usher the country back into the family of nations after its post-war isolation.

Not surprisingly, the invitation of the man who had led Japan during World War Two was hugely controversial, and many former army veterans and prisoners of war turned their backs on the royal procession in silent protest.

Some wore red gloves to symbolise the blood they saw as being on his hands while others whistled ribald old army tunes. A tree the Emperor had planted was uprooted.

Reconciliation

In 1978, Nicolae Ceausescu, the notorious Romanian communist leader, and his wife Elena were given a state visit in the vain hope that they might be encouraged to introduce some pro-Western reforms.

The Queen was so repulsed by them that, according to the royal author Robert Hardman, while out walking her dogs, she hid behind a bush in the Palace gardens to avoid bumping into the couple who were also out strolling. More than a decade later both Ceausescu and his wife were executed by a revolutionary firing squad.

Image copyright PA Image caption Huge crowds greeted Nelson Mandela in Brixton during his 1996 state visit

And even the most uncontroversial of state visits, that of President Mandela in 1996, was not without political purpose.

There was a feeling in the Foreign Office that South Africa was beginning to slip away from the West towards the unaligned nations, and they wanted to hug Madiba close and remind his country of Britain's anti-apartheid credentials.

More recently, in 2014, the state visit of the Irish president to Britain was used as another step of reconciliation.

Image copyright Getty Images Image caption The Irish president's state visit in 2014 drew former IRA leader Martin McGuiness to Windsor Castle

Martin McGuiness, the former Northern Ireland deputy first minister and former IRA leader, not only put on white tie and tails for a state banquet at Windsor Castle, but he also stood for a toast to the Queen.

And the state visit of President Xi in 2015 was a deliberate attempt by George Osborne, the then Chancellor, to curry favour with the Chinese and boost British trade links.

As for American presidents, only two have been granted full state visits during the current Queen's reign: President Bush in 2003 and President Obama in 2011.

What is unusual is the speed with which Mr Trump has been issued with an invitation for a state visit, just days into his presidency.

Both Messrs Bush and Obama had to wait until well into their terms of office before they got the call.

The haste reflects the importance the prime minister places on securing a good relationship with the new president and winning a post-Brexit trade deal, even if there is some political cost.

'Some experience in these matters'

Mr Bush's visit was by no means uncontroversial, coming so soon after the beginning of the Iraq war.

There were demonstrations throughout the trip, including one involving tens of thousands in central London when an effigy of the president was toppled over in a parody of events in Baghdad.

Image copyright Chris Jackson Image caption President Obama made a state visit half way through his first term of office

So the Queen may be above politics but state visits are not.

They are used for diplomacy and are often controversial. And whatever protests may surround any Trump state visit, the Queen will have seen it all before. Rarely has she shown herself unable to cope with whomsoever the government brings round for tea.

As one royal insider told me dryly: "She does have some experience in these matters."

Or as former foreign secretary William Hague wrote more bluntly in the Telegraph this morning, "A Queen who has been asked over the decades to host tyrants such as Presidents Mobutu of Zaire and Ceausescu of Romania is going to take a brash billionaire from New York effortlessly in her stride."