Saudi King Salman's trip to Egypt was meant to display the strength of ties between the two allies. But Cairo's transfer of two Red Sea islands to Riyadh during the visit stung Egyptian pride and drew criticism of what some saw as excessive Saudi influence.
The visit was meant to bury claims that diverging priorities in Yemen and Syria had damaged relations and demonstrate that Egypt and Saudi Arabia were vital to each other's security.
But after five days of official obsequiousness towards the 80-year-old monarch and no sign of any direct Saudi aid money, Saturday's news on the islands overshadowed the visit's original purpose.
Outraged Egyptians accused their once-popular president, Abdel Fattah al-Sisi, of giving up land to curry favour with the Saudis.
Cartoons on social media showed the Sphinx in a traditional Gulf Arab headdress while the front page of Al Maqal newspaper asked: "Are we living the years of the Saudi Republic of Egypt?"
On Twitter, the hashtag "I feel like selling what to Saudi Arabia" trended on Tuesday, with commentators suggesting Egypt flog everything from self-serving lawmakers to Sisi himself.
Beyond the trip's public relations debacle, Sisi faces uncomfortable questions about the future of relations between the two countries as Saudi largesse is shrinking and Egypt appears to have little to offer in return.
Egypt has struggled to get its economy back on track since the 2011 uprising that toppled Hosni Mubarak.
Saudi Arabia has showered Egypt with billions of dollars in aid since 2013, when Sisi ousted elected President Mohammed Mursi of the Muslim Brotherhood and banned the Islamist movement, which Riyadh oppposes.
But falling oil prices have forced Saudi Arabia to overhaul its economic policies and rethink priorities. Early in the royal trip, a Saudi businessman told Reuters there would be no more free money for Egypt.
After all, despite the billions Saudi Arabia and its Gulf allies have provided bail Egypt out, Sisi took only a limited role in the Saudi-led war in Yemen and disagrees on key aspects of the war in Syria.
With Middle East in turmoil, the two countries still need each other, analysts agree, but are running out of ways in which they can help each other.
Egypt needs Gulf Arab money to keep itself afloat and the controversial decision to hand back the islands should be seen in that context, said Amr Adly, nonresident scholar at the Carnegie Middle East Center.
"We can expect things that are very desperate. And giving up the islands is already very desperate," he told Reuters.
Saudi and Egyptian officials said the uninhabited islands of Tiran and Sanafir belong to the kingdom and were only under Egyptian control because Saudi Arabia's founder asked Egypt in 1950 to protect them.
But the agreement to hand them over, which still needs ratification by Egypt's parliament, caused consternation among many Egyptians, who were taught in school that the islands were theirs.
As the furore filled newspapers and airwaves, Sisi invited a group of parliamentarians, ministers and opinion-formers to the presidential palace to reassure them that he would "not sell our land to anyone and would not take land from anyone."
In a speech, Sisi said Egypt did not want to cause problems with Saudi Arabia by refusing to return its land and repeatedly beseeched his audience to stop questioning the move.
"I'm not taking this issue personally at all ... but please let's not talk about this issue again," he said.
But even Egyptians who were willing to accept the islands as Saudi property were upset that Israel was consulted in advance - the islands are entangled in Egypt's 1979 peace deal with Israel - but the Egyptian people and parliament were not.
The announcement was buried at the bottom of a cabinet statement issued late on Saturday, giving the impression that the government had hoped no one would notice.
"What hurts most is the phone call to Tel Aviv that came before everything, and these massive headlines in the most important newspaper in Egypt reassuring Israel before explaining anything to the Egyptian people," prominent journalist Yosri Fouda wrote on his Facbook page.
The next day, King Salman visited parliament, where lawmakers waved the Saudi flag and repeatedly interrupted proceedings with thunderous applause and impromptu poetry recitals. Above the parliament building, next to the Egyptian flag, fluttered the green banner of Saudi Arabia.
Al Masry Al Youm newspaper counted the times lawmakers clapped in the 15 minutes the king was in the house - 23.
The spectacle added to a general sense among Egyptians that economic mismanagement and reliance on Saudi aid had left them too beholden to their neighbour.
For the Saudis, at least, the king's visit achieved its objectives.
The extraordinary length of his stay and engagements that included a meeting with the Coptic Pope and a visit to Cairo University, along with $4 billion in private sector investment pledges, reinforced the message that ties were close, though perhaps uncomfortably close for some Egyptians.
"He basically established to the region that Riyadh and Cairo stand shoulder to shoulder even if they don't agree on certain issues and that disagreement on certain issues may be annoying but not to the extent that it is upsetting the relationship in a disturbing fashion," said H.A. Hellyer, senior nonresident fellow at the Atlantic Council.
"The visit was a failure in terms of Egyptian public opinion because of the islands issue ... But it's dubious to think that upset is going to snowball."For all the latest GCC news from the UAE and Gulf countries, follow us on Twitter and Linkedin, like us on Facebook and subscribe to our YouTube page, which is updated daily.
Subscribe to Arabian Business' newsletter to receive the latest breaking news and business stories in Dubai,the UAE and the GCC straight to your inbox.