JERUSALEM — An advocate for Human Rights Watch must leave the country by May 1, an Israeli court ruled on Tuesday, upholding a deportation order issued under a contentious law that bars entry to foreigners who have publicly called for a boycott of Israel or its settlements in the occupied West Bank.

The deportation order against Omar Shakir, an American citizen and the organization’s Israel and Palestine director, is the first application of the law against a person lawfully present in Israel.

The case against Mr. Shakir comes as part of a broader Israeli clampdown against the international movement to boycott Israel, a campaign that the government, empowered by the staunch support of President Trump, says delegitimizes the country and smacks of anti-Semitism.

Activists defend the movement as a nonviolent means to protest Israel and its policies toward Palestinians, along with its settlements, which most of the world considers to be a violation of international law. Last week, the United States barred entry to Omar Barghouti, one of the co-founders of the Boycott, Divestment and Sanctions movement, also known as B.D.S., without explanation.