In a victory for freedom of speech advocates and a setback for conservative state leaders, U.S. District Judge Robert Pitman on Thursday issued a temporary injunction on a politically charged law that bars state contract workers from boycotting Israel.

By blocking the state from enforcing the 2-year-old law, Pitman sided with Palestinian speech pathologist Bahia Amawi, who lost her contract position with the Pflugerville School district in October when she refused to sign her initials on an agreement saying she does not boycott Israel and would not do so for the remainder of her contract.

Amawi, a 46-year-old mother from Round Rock, testified in Pitman's Austin courtroom last month that she refuses to buy certain items, such as hummus and classroom toys, that are made by Israeli companies. Staring out at dozens of members of the local Muslim community, she told the court that Israel has long mistreated her family and other Palestinians and she could not in good conscience certify that she would refuse to boycott the country.

In 2017, Gov. Greg Abbott signed a law that prohibits governmental entities from contracting with and investing in companies that boycott Israel, the state's fourth-leading trade partner. The law is a response to the “Boycott, Divestment and Sanctions” movement, often referred to as BDS, that seeks to change Israeli policy toward Palestinians. In defending the constitutionality of the law, Texas Attorney General Ken Paxton has said the state had a right to boycott boycotters.

But Pitman, who was appointed to the bench in 2014 by President Barack Obama, wasn't persuaded bythe state's attorneys at a hearing last month. He pointedly asked a lawyer with the attorney general's office, “What is Texas’ interest in this law?”

The decision clears the way for Amawi to return to her position teaching 3-, 4- and 5-year-olds.

The Pflugerville school district "has enjoyed our working relationship with Ms. Amawi and appreciate the opportunity to utilize her services in the future," a district spokeswoman said in a statement. "We are hopeful that the court dispute finds a way to quick resolution for all concerned."

Amawi's wasn't the only pro-boycott victory that Pitman delivered Thursday. The judge denied motions to dismiss related lawsuits filed by the University of Houston and Texas A&M, as well as the Lewisville and Klein school districts. Those complaints arose from debate competitions in which two men who wanted to be judges were required to initial a document saying they don't boycott Israel.

Amawi's lawyer, Gadeir Abbas, called the ruling "a complete victory for the First Amendment against Gov. Abbott's attempt to suppress the rights of Texans to exercise their constitutional rights."

He added: "This victory should send an important warning to federal and state lawmakers across the country who have sought to suppress rights of Americans to engage in the wonderful American tradition of expressing their views via boycott. This is going to be a stain on Gov. Abbott's record forever."

A spokeswoman for the Texas Attorney general's office did not return a message for comment Thursday.

Earlier this year, state Rep. Phil King, R-Weatherford, introduced legislation that would amend the law to stop it from applying to individuals like Amawi. But the amendment is unsatisfying, Amawi said, because it would not strike language that stops the government from contracting with companies that boycott Israel.

This month, Airbnb announced it had backtracked on a plan to delist its properties in Israeli settlements in the West Bank, after Texas had banned state employees from doing business with the company for work purposes.