A federal judge Thursday temporarily blocked a new Illinois law that targeted crisis pregnancy centers, saying it violated free speech. 

U.S. District Judge Iain Johnston, who was appointed by former President Trump, called the law "painfully and blatantly a violation of the First Amendment."

The ruling came after four hours of testimony from pro-life advocates who said the law had infringed on their free speech and ability to hand out literature that gives alternatives to abortion.

"It’s going to stop us from offering mothers a choice," Kevin Rilott, director of the Rockford Family Initiative and a plaintiff in the lawsuit, said. 

ILLINOIS GOV. PRITZKER SIGNS SWEEPING ABORTION PROTECTIONS INTO LAW

sign outside a crisis pregnancy center

A judge ruled an Illinois law that targets crisis pregnancy centers violates free speech.  (Pat Greenhouse/The Boston Globe via Getty Images)

He said before the law passed around 100 people regularly attended their prayer vigils, but that dwindled to around 30 afterward. 

On July 27, Gov. J.B. Pritzker signed the Deceptive Practices of Limited Services Pregnancy Centers Act that allows the state attorney general to crack down on crisis pregnancy centers deemed to be using "deceptive tactics" to influence pregnant women who come to them to not get abortions. 

"Women need access to comprehensive, fact-based health care when making critical decisions about their own health — not manipulation or misinformation from politically motivated, nonmedical actors," Pritzker said in a statement when he signed the law. "By empowering the attorney general's office to battle deceptive practices, we're ensuring Illinoisans can make their own decisions about their bodies using accurate and safe information."

TEXAS JUDGE RULES STATE'S ABORTION LAW TOO RESTRICTIVE FOR WOMEN WITH PREGNANCY COMPLICATIONS

Gov. JB Pritzker

Gov. JB Pritzker said he predicted the law would be upheld. (AP Photo/Charles Rex Arbogast, File)

The law would allow the state attorney general to investigate complaints about crisis pregnancy centers and strengthens the attorney general’s authority to prosecute incidences of consumer fraud in such cases. Violators of the law could face up to a $50,000 fine. 

"It was very heartening to know that the judge recognized that our clients are facing a credible threat, that their speech is being chilled, and that’s really important," Attorney Peter Breen of the Thomas More Society, who represents the plaintiffs, said after the ruling. "No matter which side of the abortion issue you’re on, we don’t silence speech. The judge made that point very clearly today."

Pritzker said he was "disappointed" by the ruling but predicted the law would be upheld.

"I’m disappointed that the far-right is interfering with the ability for women to access safe medical care without deception or lies," the governor said in a statement. "This law is constitutional, and I am confident that the law will ultimately be found constitutional, and we’ll continue to work alongside Attorney General Raoul to ensure Illinois patients are protected from misinformation."

Jennifer Welch, president and CEO of Planned Parenthood of Illinois, called the ruling frustrating. 

CLICK HERE TO GET THE FOX NEWS APP

"For decades, crisis pregnancy centers have targeted our patients using deceptive and false practices," she said. "Often crisis pregnancy centers provide misleading and medically inaccurate information, sometimes deliberately misdiagnosing patients or misdating their pregnancies, so people think they have more time to decide about abortion or that they are past the time when they can have an abortion."