JERUSALEM — An American student held for two weeks at an Israeli border detention facility, on the basis of a law barring foreign nationals actively involved in promoting a boycott of Israel, was permitted to enter the country Thursday after the Supreme Court ruled in her favor.

“The inevitable impression is that invalidating the visa given to her was due to the political opinions she holds,” the judges wrote. “If this is truly the case, then we are talking about an extreme and dangerous step, which could lead to the crumbling of the pillars upon which democracy in Israel stands.”

The case of Lara Alqasem, a 22-year-old Florida native who argued against her deportation order in three court hearings, leaves a question mark over the law, passed in 2017, that takes aim at the international BDS movement — a loose affiliation of groups that call to boycott, divest from and sanction Israel because of its treatment of Palestinians. 

Israel sees BDS as a strategic threat that singles out the Jewish state unfairly, and it sought to prevent those actively involved in the boycott from entering Israel and causing further havoc.

But critics say the law amounts to little more than policing people’s thoughts. They also say that applying it too broadly could end up playing into the hands of BDS advocates, who often depict Israel as a hard-line, fascist state. 

So far, 15 people have been denied entry because of the law. 

Alqasem, whose father is of Palestinian heritage, is the first person to appeal the ban. She was accepted to a master’s degree program at the Hebrew University of Jerusalem and received a year-long student visa from the Israeli Consulate in Florida. The government revoked her visa based on the law.

Ruling on her case Thursday, the Supreme Court of Israel said there was not satisfactory cause to bar her entry.  

Minister of Strategic Affairs Gilad Erdan, whose ministry is charged with implementing and monitoring the law, said in a statement that the Supreme Court had “granted BDS a great victory.” 

“I deeply regret the Supreme Court’s decision today, which indicates a basic lack of understanding of the nature and methods of the BDS campaign. It has compromised the power of the state to fight back against the boycott activists that harm us,” he said. 

It was Erdan’s ministry that flagged Alqasem’s previous position as president of Students for Justice in Palestine, a U.S. campus group that advocates a boycott, and highlighted her presence at a protest of an Israeli hummus brand.

The ministry compiles profiles of activists based on public information online, including that published by Canary Mission, an anonymous website that documents “individuals and organizations that promote hatred of the USA, Israel and Jews on North American college campuses.”

Alqasem’s attorneys argued that her activities in Students for Justice in Palestine did not meet the legal test for the boycott law and that, in her role as president, she did not actively promote a boycott. They also argued that she was no longer involved in the group.

“The Supreme Court’s decision is a victory for free speech, academic freedom and the rule of law,” said Alqasem attorney Leora Bechor. “Israel has the right to control its borders, but that right does not give it unchecked power to turn away anyone it deems unwanted.” 

Bechor said the ruling set a precedent that would “ensure no one else is denied the right to enter Israel based on sloppy Google searches and dossiers by shadowy smear groups.”

“Lara’s case proves that thought-policing has no place in a democracy,” she said.