Sweden’s highest court Thursday blocked the extradition of two men wanted by Turkey for alleged involvement with a group Turkey blames for a 2016 coup attempt.

The Swedish court said the men, who are refugees, faced the risk of persecution if they were to be sent to Turkey.

Turkey says the men are part of a group led by U.S.-based cleric Fethullah Gulen, which Turkey considers a terrorist organization.

The Swedish court also said the allegation that the men downloaded a mobile application that is used by members of the group was not grounds for extradition because that act would not constitute participating in a terrorist organization under Swedish law.

The decision comes days after Turkish President Recep Tayyip Erdogan said he would drop his objections to Sweden joining NATO after saying Sweden was not doing enough to crack down on terrorist groups.

Sweden enacted a number of reforms in recent months, including a new counterterrorism law, as part of an agreement with Turkey.

Some information for this report came from The Associated Press and Agence France-Presse.