A top Egyptian court has issued a final ruling rejecting a government plan to transfer two uninhabited Red Sea islands to Saudi Arabia in a deal that had provoked outrage among Egyptians and prompted rare protests.

Cheers broke out in the Cairo courtroom as the judge read out the verdict confirming Egyptian sovereignty over Tiran and Sanafir and saying that the government had failed to provide evidence that the islands were Saudi.

The islands at the mouth of the Gulf of Aqaba control the narrow shipping lanes running north to the Red Sea port cities of Eilat and Aqaba, in Israel and Jordan.

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.