TEL AVIV—Israel’s top court upheld a ruling to expel the local head of the Human Rights Watch advocacy group under a new law, in a case that has drawn widespread attention to the government’s ability to push back against its critics.

The Supreme Court’s verdict would mark the first time a legal resident is ordered to leave the country under a law allowing the government to deport foreigners who support boycotting Israel. It has been used in other cases to deny entry to Israel, most notably in August when Israel invoked the measure to block Reps. Rashida Tlaib (D., Mich.) and Ilhan Omar (D., Minn.) from a visit.

The law aims to crack down on an international boycott divestment and sanctions campaign that Israel says delegitimizes the country and promotes anti-Semitism. Supporters of the boycott movement, known as BDS, say it is a nonviolent way to protest Israel and its policies toward the Palestinians.

Israel’s Supreme Court said Omar Shakir, an American who heads the four-person Human Rights Watch operation here, promoted boycotts on his Twitter account and in interviews by urging companies not to do business in Jewish settlements in the Israeli-occupied West Bank. It pointed specifically to his support of AirBnB Inc.’s decision to remove listings in the West Bank and comments urging FIFA, soccer’s global governing body, not to hold games in Israeli settlements. It also cited activity from when Mr. Shakir was a student at Stanford University before working for Human Rights Watch.

Mr. Shakir, who has been in Israel since 2016, will have 20 days to leave the country or face deportation, say Israeli officials.

Human Rights Watch criticized the Supreme Court decision and said it was considering what steps it can take to counter it.

“The Supreme Court has effectively declared that free expression in Israel does not include completely mainstream advocacy for Palestinian rights,” said Kenneth Roth, the nongovernmental organization’s executive director. “If the government now deports Human Rights Watch’s researcher for asking businesses to respect rights as we do across the world, there’s no telling whom it will throw out next.”

Human Rights Watch said neither the organization nor Mr. Shakir as its representative have called for a boycott of Israel, but have urged companies to stop working in or with settlements in the West Bank that the organization and much of the international community considers illegal under international law. The group said it aims to discourage businesses from participating in what it says are human rights abuses, using similar tactics in other countries.

Other human rights groups, a group of former senior Israeli diplomats, the European Union, the United Nations and 17 members of Congress have issued statements in support of Human Rights Watch.

“Human rights defenders play an essential role in exposing the government’s wrongdoing and fostering public debate,” said Saleh Higazi, the deputy Middle East and North Africa director for Amnesty International. “Today’s decision is a cowardly move that confirms Israel’s oppressive intent on silencing independent human rights organizations at any cost.”

For more than a year, Mr. Shakir has been fighting Israel’s efforts to expel him under the 2017 law, and Tuesday’s decision marked the final ordinary legal channel to appeal the move. Human Rights Watch said it was considering asking for a hearing before an expanded panel of Supreme Court judges, an unusual step.

Israeli officials said they expect the decision to proceed. Several right-wing Israeli organizations such as Shurat Hadin and NGO Monitor backed the efforts to expel Mr. Shakir.

Gilad Erdan, head of the Strategic Affairs Ministry that is tasked with acting against the international boycott movement, praised the decision.

“A work visa should not be given to a foreign boycott activist who wants to harm Israel and its citizens,” Mr. Erdan said. “Omar Shakir is a BDS activist who took advantage of his stay in Israel to harm it, something no sane country would allow.”

Mr. Erdan said Human Rights Watch could appoint another representative in Mr. Shakir’s place and that Israel grants hundreds of visas to human rights activists each year.

Mr. Netanyahu has pursued pro-settlement policies since returning to power in 2009 and vowed ahead of the September vote to annex Israeli settlements in the West Bank if re-elected. His efforts have had the backing of the Trump administration, which has largely stopped calling the territory occupied and has referred to settlements as neighborhoods and towns. Most other countries criticize settlement activity and view it as an obstacle to peace.

Mr. Netanyahu has failed to form a government last month, giving a rival a chance to create a coalition that could end the Israeli leader’s long tenure.

Write to Felicia Schwartz at Felicia.Schwartz@wsj.com

Copyright ©2019 Dow Jones & Company, Inc. All Rights Reserved. 87990cbe856818d5eddac44c7b1cdeb8