The law, which was passed in 2013, effectively bans street demonstrations, settling a years-long court battle.

Egypt’s Supreme Constitutional Court upheld a law on Saturday that effectively bans protests, settling a years-long court battle and protecting it from further challenges.

The law was passed in 2013 amid persistent demonstrations calling for the reinstatement of Muslim Brotherhood leader Mohamed Morsi after the military overthrew him following mass protests against his rule.

It requires would-be protesters to notify the interior ministry of any public gathering of more than 10 people at least three days in advance, imposes jail sentences of up to five years for those who violate a broad list of protest restrictions, and allows security forces to disperse illegal demonstrations with water cannon, tear gas and birdshot.

No appeal

The court’s ruling keeps all of these elements of the law intact and there is no further appeal.

Egyptian rights organisations have said that the law criminalises all forms of peaceful assembly and gives the state a free hand to disperse peaceful gatherings by force.

Its strict enforcement has largely succeeded in ending the kind of mass demonstrations that helped unseat two presidents in three years as activists who have held even small, peaceful gatherings were detained.

The ruling means that hundreds of protesters arrested under the law will remain in prison.

“It was a surprise. We were hoping that the constitutional court would come down on the side of rights. There isn’t a court in Egypt that has mercy on the people,” prominent human rights lawyer Gamal Eid told Reuters news agency.

WATCH: How far will Egypt go in attacking media freedoms?

The case was first brought to an administrative court in 2014 when a group of lawyers challenged parts of the law they said violated article 73 of the constitution.

The article allows the “right to organise public meetings, marches, demonstrations and all forms of peaceful protest while not carrying weapons of any type, upon providing notification as regulated by law”.

But the court ruled on Saturday that only article 10, which grants the interior ministry authority to deny protest requests, was unconstitutional.

It upheld three other articles being challenged, including one that requires protesters to submit detailed information on the location and purpose of their gatherings, and another stipulating jail sentences and hefty fines for illegal demonstrations, which the law defines broadly.