An Egyptian court has ruled against the government's decision to hand over two Red Sea islands to Saudi Arabia - a landmark verdict likely to deepen tensions with the kingdom.
The ruling by the Supreme Administrative Court rejected an appeal by President Abdel-Fattah el-Sissi's government against a lower court's decision to annul the islands handover agreement, signed in April during a visit by the Saudi monarch, King Salman.
During his visit, King Salman pledged billions of dollars to Egypt in loans and investments.
The agreement was condemned by many in Egypt who saw it as a land sell-off. It also sparked the largest demonstrations against Mr el-Sissi's two-year rule.
Ignoring the legal process, Mr el-Sissi's government last month approved the agreement on the islands and sent it to parliament for ratification. The 596-seat chamber is packed with Mr el-Sissi's supporters.
The verdict was met by jubilation from activists and lawyers in the courtroom in Cairo, some of whom sang the national anthem.
Outside the court, a small number of activists chanted: "Saudi Arabia, take your money back, for tomorrow, the Egyptian people will trample on you."
There were minor scuffles between police and several dozen people outside the courthouse who attempted to stage a demonstration.
The court said the two islands, Sanafir and Tiran, are Egyptian - contrary to the government's claim that they were Saudi and only given to Egypt in the 1950s to protect them from a possible attack by Israel.
"It's enshrined in the court's conscience that Egypt's sovereignty over Tiran and Sanafir is beyond doubt," the court's presiding judge, Ahmed al-Shazli, said in announcing the verdict to a packed courtroom.
The judge said the government lawyers did not provide the court with documents "or anything else" that could persuade the court to believe otherwise.
Sanafir and Tiran are located at the mouth of the Gulf of Aqaba, controlling the narrow shipping lanes running to and from the Red Sea port cities of Eilat and Aqaba, in Israel and Jordan, to the north.
The fate of the two islands has been at the heart of friction between Riyadh and Cairo over a string of regional issues, including Syria and Yemen.
Last September, Saudi Arabia unilaterally suspended fuel shipments to Egypt agreed during the king's visit to Egypt, forcing Cairo to look for alternative sellers.