Egypt's Supreme Administrative Court on Monday nullified an agreement between Egypt and Saudi Arabia that would have transferred the two Red Sea islands, Tiran and Sanafir, to Saudi waters.
According to the border demarcation agreement signed in April, the two islands were deemed to be within Saudi territorial waters, in recognition of historical claims on the part of Saudi Arabia.
Monday's ruling turned down the government's appeal against a verdict issued in June, which had reached the same conclusion.
The Administrative Court (first degree court) had nullified the agreement in two different hearings in June and November on the basis that there was insufficient evidence for the Saudi claims.
The agreement provoked extensive criticism against the government in April, with people taking to the streets in protest against the decision, which was then followed by a security crackdown.
In a speech, President Abdel Fattah al-Sisi called on the Egyptian people to not talk about the matter anymore and let the courts decide.
The initial lawsuit that was submitted to have the agreement revoked was filed by lawyer and former presidential hopeful Khaled Ali, with support from other lawyers and MPs.