It was called Operation Shamrock.

A detailed British government plan for Northern Ireland's response to the death of Queen Elizabeth.

Some unionists complained last week that the way it unfolded was more like Operation Sinn Féin.

It was all part of an over arching plan called London Bridge, the code word that would be used to announce the Queen's death to government, police and broadcasters.

"London Bridge is down" was the phrase used to communicate the news to the British prime minister, the Church of England, senior media executives and others.

Part of the detailed plan included an instruction to all onscreen BBC presenters and reporters to immediately dress in dark clothing.

There were also bespoke regional plans for the official period of mourning and the accession of King Charles.

Scotland had Operation Kingfisher while in Wales it was Operation Dragoon.

At around 7.30pm on Thursday of the week before last, less than an hour after the formal announcement that Queen Elizabeth has died, Operation Shamrock swung into action in Northern Ireland.

A letter from the head of the civil service was sent to designated contacts within the main parties at Stormont.

It was headed "London Bridge/Operation Shamrock".

The letter set out in detail what would happen during the ten-day period of National Mourning, including a visit by King Charles to royal residence in the village of Hillsborough in Co Down, and a Service of Reflection at St Anne's Anglican Cathedral in Belfast city centre.

The following morning, representatives from all of the main parties at Stormont held a virtual meeting to discuss the planned response.

It was a plan decades in the making. It's been reported that Queen Elizabeth herself initiated discussions about the response to her death in 1958. It was revised and tweaked many times, and elements of it were rehearsed in recent years as the queen's health failed.

Michelle O'Neill has vowed to be "a First Minister for all" and this was an opportunity to demonstrate that with the eyes of the world watching.

Throughout virtually all of the planning stages, it was simply taken as read that in Northern Ireland official events to mourn the queen's death and to welcome her successor King Charles would be led by unionist politicians.

Floral tributes outside Hillsborough Castle for Britain's Queen Elizabeth

Queen Elizabeth's 96-year-life spanned all but five of the years that Northern Ireland has existed and throughout virtually all of that time its politics were dominated by unionists.

That all changed in May's Assembly elections when Sinn Féin emerged as the largest party and the right for a nationalist to be appointed the head of government for the first time in its history.

That meant King Charles, who had visited Northern Ireland 39 times in his role as the Prince of Wales, was set to be greeted by Sinn Féin's Michelle O'Neill in her role as First Minister-elect during his first visit as monarch.

There would undoubtedly have been nervousness within the Northern Ireland Office about how Sinn Féin might respond.

In May last year, Michelle O'Neill surprised the NIO and the royal household by pulling out of a scheduled private meeting with the then Prince Charles in Hillsborough Castle. No official explanation was given, but the decision was based on his ceremonial role as Colonel in Chief of the British Army's Parachute Regiment.

A week before the planned meeting, a coroner in Belfast had ruled that ten people shot dead by the regiment in the Ballymurphy area of west Belfast in 1971 had been entirely innocent and that their deaths had been unjustified.

The Sinn Féin leadership knew that an official photograph of its deputy leader alongside the Colonel in Chief would have outraged relatives of those families.

As the queen's body lay at rest in the royal residence in Balmoral in the Scottish highlands last Saturday, the party's leadership team met to discuss its role in Operation Shamrock.

King Charles is still Colonel in Chief of the Parachute Regiment, but on this occasion there was no question of a no show. It was quickly agreed that the party would play a prominent role.

Michelle O'Neill has vowed to be "a First Minister for all" and this was an opportunity to demonstrate that with the eyes of the world watching.

But Sinn Féin's response was about much more than the role of First Minister-elect.

To the dismay of unionists, results in the most recent British general election, Assembly election and local council elections, and the DUP refusal to nominate a new Speaker at Stormont, all combined to put Sinn Féin in all of the prime positions for the visit.

So while thousands of unionists and loyalists lined the streets of Hillsborough and Belfast city centre, many waving union flags, to catch a glimpse of the royal couple, politically a party that dedicates itself to the removal of British sovereignty was front and centre for the first visit of a British king in more than 70 years.

Protocol dictated that the king would be greeted at Hillsborough by the Speaker of the Stormont Assembly.

When the DUP refused to support a new appointment as part of its protest against the Brexit Protocol, it meant the outgoing incumbent remained in place.

The result was that the first local politician to shake hands with the king at Hillsborough was Sinn Féin's Alex Maskey, a former republican internee who was shot by loyalists in the 1980s.

Next in the line was Michelle O'Neill, and then DUP leader Jeffrey Donaldson, Alliance leader Naomi Long, Ulster Unionist Doug Beattie and Matthew O'Toole of the SDLP.

Later on arrival at the service of reflection at St Anne's Cathedral, as laid out in Operation Shamrock, Charles and the Queen Consort Camilla were welcomed by the MP for North Belfast and the city's Lord Mayor.

Until the last British general election in 2019 the MP for the constituency had been either Ulster Unionist or DUP, but Sinn Féin's John Finucane topped the poll last time around so it was he who stood waiting as the royal car arrived.

Alongside was his party colleague Tina Black, appointed Lord Mayor of Belfast in June.

Unionist unease and in some quarters resentment at being sidelined escalated throughout the past week as the media honed in on a handshake and warm conversation between the king and Michelle O'Neill and the role of Alex Maskey.

Those feelings were no doubt exacerbated by footage of the private meeting between the British monarch and the local politicians inside Hillsborough.

Normally just a few still photographs would have been issued, but on this occasion a videographer working for the royal household recorded the meeting and afterwards released video footage to the broadcast media.

It showed King Charles first of all shaking hands and exchanging a few words with Alex Maskey, with the king expressing the desire to "keep continuity ... and reconciliation".

Next in line was Michelle O'Neill, who clasped the King's right hand in both of hers as he thanked her for "the incredible kind things that you said about my mama".

That was a reference to a speech by the Sinn Féin deputy leader in the Stormont chamber the previous day in which she described Queen Elizabeth as "a courageous and gracious leader" and acknowledged "the huge sense of grief and loss many, many people will be feeling at this time across our community".

In response to King Charles's words of gratitude on Tuesday, Ms O'Neill told him his mother had "played a great role here in terms of reconciliation and building our peace".

There were then a few words about the last time they had met, in Cork, before Charles referenced the fact that Sinn Féin is now the largest party in Northern Ireland.

"Don't be telling Jeffrey that," quipped Mr Maskey as the DUP leader looked on awaiting his introduction.

As Mr Donaldson bowed and shook the outreached hand of the king, he welcomed him to his constituency, which includes the village of Royal Hillsborough.

As a member of the privy council, Mr Donaldson had been part of the Accession Council which had proclaimed Charles as king.

"I have seen you occasionally in the past," King Charles remarked.

The optics suggested a greater familiarity and warmth between the monarch and Sinn Féin's deputy leader.

Then the eyes of the world later watched as Mr Maskey delivered a message of condolence on behalf of the Stormont Assembly.

His speech included a few words in Irish: "Ba mhaith liom comhbhrón a dheanamh leat ag an am crua seo." ("I would like to sympathise with you at this difficult time.")

And it ended with: "Ar dheis Dé go raibh a hanam." ("May she rest in peace.")

Between those phrases, carefully crafted words also made a political point, referencing the Good Friday Agreement and saying Queen Elizabeth had "personally demonstrated how individual acts of positive leadership can help break down barriers and encourage reconciliation".

With the Stormont Executive still in limbo due to the DUPs refusal to engage as part of its Bexit Protocol protest, the Stormont Speaker added "that often that leadership has been lacking when it has been required".

Many unionists were also deeply uneasy about some of the optics at St Anne's Cathedral.

For many observers there was a sense that Sinn Féin had managed to steal the show.

In addition to being greeted by Sinn Féin's John Finucane and Tina Black, the 800 strong congregation inside included President Michael D Higgins, his wife Sabina, Taoiseach Micheál Martin and Minister for Foreign Affairs Simon Coveney.

President Michael D Higgins and Britain's King Charles at the service in St Anne's Cathedral

The President had angered unionists in October last year when he declined an invitation to attend a church service in Co Armagh to mark the centenary of partition and the creation of Northern Ireland.

Queen Elizabeth had been due to attend but withdrew due to concerns about her health, the first public signal that she was in decline.

But on Tuesday, he was at the front of the church. Not only that but at the end of the service, King Charles made a point of approaching him, shaking hands and exchanging pleasantries.

Less than a year after being criticised by unionists for refusing to attend a church service Queen Elizabeth had been scheduled to attend, President Higgins became the first head of state from another country to meet King Charles and expressed condolences on behalf of the people of Ireland.

Speaking before the first event at Hillsborough on Tuesday, Jeffrey Donaldson had said Sinn Féin's participation and response to the Queen's death was "a sign of political maturity".

"It is an indication of how far we have travelled in Northern Ireland," he said.

"I think this would not have been possible and it wouldn't have happened during the dark days of our troubled past."

Britain's King Charles with DUP leader Jeffrey Donaldson

For many observers there was a sense that Sinn Féin had managed to steal the show.

Reflecting on the events and the coverage, retired veteran journalist Deric Henderson, a former editor of the Press Association in Ireland, said in a Twitter list that "you can't help thinking. In the most significant and illuminating royal visit to Northern Ireland in living memory, did republicanism leave unionism in the shade?"

The images and reporting of Sinn Féin's role in the events was too much for former DUP leader Arlene Foster to bear.

Writing in her column in the Daily Express, the GB News presenter accused the media of focusing "far too much" on King Charles meeting members of Sinn Féin.

"The coverage got so intense about Sinn Féin on some mainstream broadcasts that you would be forgiven for thinking the visit was about them, and not marking the death of our sovereign and the first visit of her successor!

"Inside the (Hillsborough) Castle the politicians had assembled and much has been said (far too much in my view) about the meeting between Sinn Féin members and the new King."

Referencing the fact that Sinn Féin members had met royalty before, with a public handshake between Queen Elizabeth and former IRA commander Martin McGuinness the first and most high profile encounter in 2012, she said such encounters were "not really big news".

Ms Foster, who was one of those who attended the service in St Anne's Cathedral, also fired a broadside at President Higgins.

"The President of Ireland, as he is styled, who could not bring himself to attend an ecumenical service to mark the centenary of Northern Ireland last year was present on this occasion to remember our gracious Queen. Progress of sorts."

The Labour Party MP for Vauxhall, staunch unionist and Co Antrim native Kate Hoey, backed Ms Foster and chided the media for not referencing the fact that Michelle O'Neill had recently said she believed there had been "no alternative" to the IRA's campaign of violence.

She also said the Irish Government's presence in St Anne's was "far too big".

Jim Allister, the leader of the Traditional Unionist Voice and its sole Assembly member, also vented his anger, saying "the Sinn Féin part of that narrative is incidental, rather than central".

The Irish Government hopes the response to the monarch's death will act as a catalyst to repair bridges between Ireland and Britain

Other unionists were also angered and have privately accused the Northern Ireland Office of bending over backwards to ensure Sinn Féin participated in the events.

They say this included a decision not to invite all 90 members of the Stormont Assembly to the St Anne's service because Sinn Féin had indicated that the majority of its 27 Assembly members would not attend.

Instead, in addition to party leaders, the DUP, Alliance Party and Ulster Unionists were each given just two tickets for the service.

"It was absolutely grotesque," said a senior unionist official.

"Unionist politicians who felt a genuine deep sense of loss were denied the opportunity to formally mourn the Queen and to welcome their new King because of concerns that Sinn Féin members not attending would look bad."

They also accused Sinn Féin of blocking moves to honour and mourn the queen in local councils where the party holds the position of major or deputy mayor.

"There were proposals in a number of councils to cancel planned meetings as a mark of respect that were rejected by Sinn Féin.

"Requests to flag Union flags at half mast and to light up council buildings were also rejected.

"Sinn Féin were very smart about it. In places where the cameras were watching they did what any reasonable person would have considered to be the right and proper thing and showed respect, but away from the cameras it was the same old story."

There were several private encounters in the margins of the official public events.

Taoiseach Micheál Martin and British Prime Minister Liz Truss at the service in Belfast

Shortly after arriving at St Anne's, the Taoiseach and Minister Coveney were brought into a side chapel, the Unity Chapel, for their first formal introduction to Liz Truss since she became British Prime Minister.

There was no official business, but it was the first encounter since she came into office.

All eyes are now on Queen Elizabeth’s state funeral in London on Monday.

Michelle O'Neill and Alex Maskey will both attend, but will be well down the pecking order of world leaders and dignitaries.

The Irish Government hopes the response to the monarch's death will act as a catalyst to repair bridges between Ireland and Britain, and between unionists and nationalists at Stormont.

But there is little evidence to suggest the latter could be on the cards.

In a tweet after their meeting, Jeffrey Donaldson said the DUP had "expressed our confidence that he too will cherish Northern Ireland and our place in the Kingdom".

That means, for the DUP, that the Northern Ireland Protocol dispute must be resolved to its satisfaction as it argues the legislation draws a dividing line between Northern Ireland and the rest of the UK.

The truce between the political parties at Stormont will end on Friday, the day it's been privately agreed that political relations will return to normal after the UK's national period of mourning.

The expectation is that it will be a return to what some critics have called Groundhog Day, with Sinn Féin and the DUP going back into their respective trenches.

If they fail to reach agreement to restore power sharing by the end of October, the new Northern Secretary Chris Heaton-Harris is legally compelled to set the date for fresh Assembly elections. He has told both parties he will have no hesitation in doing so.

Northern Ireland's Electoral Office last week sent letters to venues which could be used as polling stations advising that the next election could potentially be held on 8 or 15 December this year.

If that's the case, the DUP will hope to win back votes it lost to Jim Allister's TUV in May and emerge once again as the largest political party, and deny Michelle O'Neill the opportunity to serve a day as First Minister.

Sinn Féin has inflicted massive electoral damage on its nationalist rival the SDLP in the years since the Good Friday Agreement in 1998, and may feel the number of additional votes it can draw from that well may be drying up.

The party is also aware that it haemorrhaged votes from "soft nationalists" to the Alliance Party in May and that winning back those could be key to maintaining its place as the largest party.

It will hope that being seen to reach out hands of friendship to its sworn adversary could pay dividends at the ballot box.

Operation First Minister is well under way.