The Jerusalem District Court issued an interim order on Wednesday blocking the deportation of Human Rights Watch representative Omar Shakir from Israel until at least July in a dizzying chain of events.

Last week, the same court had denied Shakir’s request to block an Interior Ministry order for him to leave Israel by this Thursday or be forcibly deported.

However, following an appeal by Shakir to the Supreme Court, which ordered the district court to consider legal issues that it had not reviewed, the court reversed itself.

Wednesday’s interim order set July 2 for the next court hearing about whether Shakir will get to stay long term. But it froze any deportation proceedings in the interim.

Only minutes before HRW made the court decision public, the group had sent the media a notice scheduling a press conference for Thursday right before Shakir was expected to be deported.

When contacted, HRW’s lawyer in the case, Michael Sfard, appeared as surprised by the breaking news as the media.

In early May, Interior Minister Arye Deri issued the deportation order with an approximately two-week period before it would go into effect.

The Interior Ministry said in a statement at the time that Deri had acted on the recommendation of the Strategic Affairs Ministry, which said it had gathered data that shows Shakir “is an active and consistent supporter of boycotting Israel.”

“It is unacceptable that boycott promoters are allowed visas to stay in Israel while at the same time causing harm to the country,” Deri said in a statement. “I will do everything in my ability to prevent such individuals from entering or residing in Israel, and therefore Mr. Shakir has been refused permission to continue to work in the country.”

HRW, a New York-based rights organization, had said the decision showed Israel was seeking to suppress criticism of its human-rights record, adding that it would challenge the decision in court.

Shakir, a lawyer and a US citizen, had denied the allegation, contending neither he nor HRW promoted a boycott.

Israel last year initially denied Shakir a work permit, in a move criticized by the United States, but later granted him a one-year work visa.

The district court’s decision on Wednesday said neither it nor the Interior Ministry had taken into account a recommendation by the Foreign Ministry to permit Shakir to remain in the country and had acted solely based on the Strategic Affairs Ministry recommendation to deport him. The court also said it had previously been given incomplete information, missing crucial updates about whether Shakir had the right to remain in the country.

Israel has recently cracked down on human-rights groups and activists who support boycotts of Israel and settlements.

In March 2017, the Knesset passed a law that bans supporters of boycotts from entering the country.

HRW frequently issues reports critical of Israeli policies related to the West Bank and Gaza, including those that pertain to settlements.

In a report published January 2016, the organization called on businesses to cease all activities that benefit settlements.

Adam Rasgon contributed to this report.