CAIRO, Egypt, June 7 – An Egyptian appeals court, quashed a Feb decision by another tribunal, branding Hamas a “terrorist” group, a court official said.

The decision comes as relations between Cairo and Hamas have deteriorated, since the 2013 ouster of Muslim Brotherhood president, Mohamed Morsi, by Egypt’s then army chief and now President, Abdel Fattah al-Sisi.

Egyptian authorities have accused both Hamas and the Muslim Brotherhood of backing militants, who have carried out deadly attacks on security forces in the Sinai Peninsula that borders the Hamas-ruled Gaza Strip.

The court official told AFP that the earlier ruling labelling Hamas as a “terrorist” group was thrown out because the court that issued it was not “competent” to make such verdicts.

Hamas issued a brief statement in response, saying that the new ruling corrects “a wrong decision.”

“Hamas welcomes the Egyptian court’s decision,” it added.

The ruling, initially made in Feb, came after Egyptian lawyer, Samir Sabri, filed a lawsuit against Hamas, saying it was behind attacks in the Sinai Peninsula and that Hamas leader, Khaled Meshaal, had planned them.

Sabri petitioned the court to classify Hamas as a terrorist organisation, however in Mar, the government appealed against the ruling.

The Islamist movement had strongly condemned the Feb verdict — which came just one month after another court had also ruled Hamas’s armed wing, the Ezzedine al-Qassam Brigades, a “terrorist group.”

Hamas has denied any involvement in attacks on military and police targets in Egypt, as has the Muslim Brotherhood, which was also blacklisted by Egypt as a terror group in 2014.

Most attacks in the restive Sinai Peninsula have been claimed by Ansar Bayt al-Maqdis, a militant group that changed its name to Sinai Province after pledging allegiance to the Islamic State group in Iraq and Syria.

In efforts to prevent attacks, the Egyptian army says it has destroyed hundreds of tunnels used for smuggling supplies and arms between Sinai and Gaza, and also used by militants to infiltrate into Egyptian territory.

In Mar 2014, Egypt banned all Hamas activities on its soil and froze its assets.

The ebb and flow of tensions in between Hamas and Egypt have led to continual closures of the Rafah crossing between southern Gaza Strip and Egypt, and the Egyptian army has also created a wide buffer zone along the border, allegedly aimed at preventing infiltration by militants.

As the Rafah crossing into Egypt has been the coastal enclave’s principal connection to the outside world, since the imposition of an Israeli blockade since 2007, Egypt-Hamas relations hold high stakes for Gaza’s 1.8 million residents, who rely on both the border crossing and tunnels to obtain basic necessities.