High Administrative Court also ruled that the two Red Sea islands Tiran and Sanafir will continue under Egypt's sovereignty.
The court verdict is final and cannot be appealed.
In its verdict, which was aired on the Egyptian TV, the court said that "Egyptian army has never been an army of occupation" and that the government did not provide sufficient documents that supports its decision.
The court's decision was appealed by the government.
Egypt's State Lawsuits Authority - the body representing the government in legal cases - has appealed in June the court verdict that voided a decision by the government to place two islands in the Red Sea under Saudi Arabia's sovereignty.
On April 7, an Egypt and Saudi Arabia signed an agreement to transfer the two islands Tiran and Sanafir to Saudi Arabia during the visit by Saudi King Salman to Cairo.
The protesters, in different parts of the country, organised marches against the deal and accused the government of selling the islands in return for Saudi investments.
The police used tear gas to disperse the anti-government rallies and many protesters were arrested as street protests are banned without prior permission from police according to a controversial protest law issued in 2013.
Egyptian lawyers Khaled Ali and Ali Ayoub had filed a lawsuit to the Egyptian Administrative Court at the State Council against the deal.
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.
Disclaimer: No Business Standard Journalist was involved in creation of this content
