A federal judge on Tuesday temporarily blocked a Kansas law barring state contractors from participating in boycotts against Israel, saying the state law violates their free speech rights.

U.S. District Judge Daniel Crabtree wrote in his decision that the U.S. Supreme Court has held that the "First Amendment protects the right to participate in a boycott like the one punished by the Kansas law."

Several states have enacted laws in recent years amid an increasingly visible movement protesting Israel's policies toward Palestinians. Backers of boycotting Israeli companies argue they're defending Palestinians' human rights, while boycott critics contend the goal is to destroy the Jewish state.

The judge granted the request from the American Civil Liberties Union to block enforcement of the Kansas law while the case proceeds. Crabtree found it is "highly likely" that the Kansas law is invalid.

"A desire to prevent discrimination against Israeli businesses is an insufficient public interest to overcome the public's interest in protecting a constitutional right," Crabtree wrote.

The ACLU brought the lawsuit on behalf of Esther Koontz, a math and science curriculum coach at a Wichita public school. She is seeking to overturn a law that took effect in July that prohibits the state from entering into contracts with individuals or companies participating in a boycott of Israel.

Twenty-four states have such policies, including California, Alabama and Texas, according to Palestine Legal, a non-profit advocacy group that aims to protect the rights of people who speak out for Palestinian freedom. The measure had strong bipartisan support in Kansas.

ACLU attorney Brian Hauss said the court recognized the harms imposed by the "misguided law," which imposes "an unconstitutional ideological litmus test."

"This ruling should serve as a warning to government officials around the country that the First Amendment prohibits the government from suppressing participation in political boycotts," Hauss said.

The ACLU has also filed a legal challenge to a similar law in Arizona prohibiting contractors from boycotting Israel, but this is the first court ruling in the country dealing with such laws, said ACLU attorney Doug Bonney.

Departing Gov. Sam Brownback, who signed the policy into law, said he thinks the ACLU will ultimately lose the case.

Brownback, a Republican, said the federal government has passed such laws for years. He cited laws against trade with Iran or limits on investments in South Africa during apartheid.

Brownback is stepping down as governor Wednesday to become U.S. ambassador-at-large for international religious freedom.

State officials have described Israel as an important trading partner, with Kansas exporting $56 million worth of products there in 2016 while buying $83 million worth. Brownback made an unpublicized visit to Israel last summer, during which he met with Prime Minister Benjamin Netanyahu.

Crabtree wrote that he is not persuaded by the state's argument that enjoining the Kansas law will cause Israeli companies to refuse to do business in Kansas, or with Kansas companies, and thus harm the Kansas economy.

The lawsuit said Koontz, who lives about 25 miles (40 kilometers) north of Wichita in Newton, is a Mennonite and the wife of a pastor. She decided to boycott Israeli products and services to "support the Palestinians' struggle for equality."

A Kansas State Department of Education official told Koontz in August that she could not be paid as a teacher trainer because she refused to certify that she was not participating in a boycott of Israel. The lawsuit names state Education Commissioner Randy Watson as the defendant.

In his ruling, Crabtree wrote that Koontz and other members of the Mennonite Church have "banded together" to express collectively their dissatisfaction with Israel and influence governmental action.

The law's legislative history reveals that its goal is to undermine the message of those participating in a boycott of Israel, the judge wrote. This is either viewpoint discrimination against the opinion that Israel mistreats Palestinians, or subject matter discrimination on the topic of Israel — both impermissible goals under the First Amendment, Crabtree said.

State Rep. Randy Powell, a conservative Olathe Republican who pushed for the law, said he remains confident that it's constitutional.

"It still allows for freedom of speech. It still allows individuals to boycott," he said. "But any state can choose to do business with who they wish."

___

Associated Press Writer John Hanna contributed to this report from Topeka.