In its ruling, the High Administrative Court said it was its "unanimous" decision that the two islands -- Tiran and Sanafir -- were sovereign Egyptian territories.
The courtroom erupted in cheers as the judge delivered the verdict, with lawyers and activists chanting: "These islands are Egyptian."
The decision came after the government referred the agreement to parliament for a vote.
It may further complicate ties between Egypt and Saudi Arabia, a main financial backer of Sisi since the former army chief toppled his Islamist predecessor in 2013.
Saudi Arabia has already signalled unease by stopping a promised flow of oil to Egypt, leaving Cairo scrambling to find a new supplier.
But relations have cooled over Egypt's stance on war-torn Syria, whose President Bashar al-Assad is seen as closer to Russia than Saudi Arabia which supports rebels fighting him.
Lawyers present in court told AFP the ruling was final, but a former senior judge said the government could still find a way to appeal it.
- Unconstitutional? -
Mohamed Hamed al-Gamal, the former head of the administrative court, said the decision was final according to this court's procedure, but it could be unconstitutional.
"The law and the constitution affirm the absence of administrative court jurisdiction in sovereign matters such as international treaties," Gamal said.
The government may challenge the ruling before the constitutional court, he added.
The deal to hand over the islands, signed during an April visit by Saudi King Salman in which Riyadh showered Egypt with aid, provoked accusations that Cairo had "sold" the strategic islands.
Cairo said the islands were Saudi to start with, but had been leased to Egypt in the 1950s.
But even many who agreed with the government objected to the way the deal was announced, buried in a cabinet statement a day after it was signed.
Two rare protests were held in downtown Cairo in April against the deal, leading to clashes with police and arrests of activists.
More than 100 people were jailed for up to five years for taking part in demonstrations that police quickly dispersed, but they were later freed on appeal.
Police had also made scores of arrests in the lead-up to the protests to discourage a repeat of a large rally on April 15 at which demonstrators chanted for the "fall of the regime".
Sisi had defended the deal, and said in a televised meeting with politicians that his mother had taught him "not to take other people's belongings".
He further requested that the matter not be brought up again.
----------------------------------------------------------------------------------------------------
The courtroom erupted in cheers as the judge delivered the verdict, with lawyers and activists chanting: "These islands are Egyptian."
The decision came after the government referred the agreement to parliament for a vote.
It may further complicate ties between Egypt and Saudi Arabia, a main financial backer of Sisi since the former army chief toppled his Islamist predecessor in 2013.
Saudi Arabia has already signalled unease by stopping a promised flow of oil to Egypt, leaving Cairo scrambling to find a new supplier.
But relations have cooled over Egypt's stance on war-torn Syria, whose President Bashar al-Assad is seen as closer to Russia than Saudi Arabia which supports rebels fighting him.
Lawyers present in court told AFP the ruling was final, but a former senior judge said the government could still find a way to appeal it.
- Unconstitutional? -
Mohamed Hamed al-Gamal, the former head of the administrative court, said the decision was final according to this court's procedure, but it could be unconstitutional.
"The law and the constitution affirm the absence of administrative court jurisdiction in sovereign matters such as international treaties," Gamal said.
The government may challenge the ruling before the constitutional court, he added.
The deal to hand over the islands, signed during an April visit by Saudi King Salman in which Riyadh showered Egypt with aid, provoked accusations that Cairo had "sold" the strategic islands.
Cairo said the islands were Saudi to start with, but had been leased to Egypt in the 1950s.
But even many who agreed with the government objected to the way the deal was announced, buried in a cabinet statement a day after it was signed.
Two rare protests were held in downtown Cairo in April against the deal, leading to clashes with police and arrests of activists.
More than 100 people were jailed for up to five years for taking part in demonstrations that police quickly dispersed, but they were later freed on appeal.
Police had also made scores of arrests in the lead-up to the protests to discourage a repeat of a large rally on April 15 at which demonstrators chanted for the "fall of the regime".
Sisi had defended the deal, and said in a televised meeting with politicians that his mother had taught him "not to take other people's belongings".
He further requested that the matter not be brought up again.
----------------------------------------------------------------------------------------------------