A federal judge in Spokane issued a permanent injunction Tuesday preventing the Trump administration from cutting grants to Planned Parenthood that pay for a teen pregnancy prevention program in Western states.

“This has real-world implications. The teen pregnancy prevention program will be allowed to continue,” said Rick Eichstaedt, an attorney for the Spokane-based Center for Justice, which filed the suit Feb. 15 on behalf of Planned Parenthood of Greater Washington and North Idaho.

Attorneys representing Planned Parenthood and the U.S. Department of Health and Human Services both presented oral arguments Tuesday morning before U.S. District Court Judge Thomas Rice, who issued his written ruling later in the day.

“The Court finds that HHS arbitrarily and capriciously terminated the TPP Program,” Rice wrote in his decision filed at about 5:30 p.m. “The Court determines that the public interest weighs in favor of (Planned Parenthood), as it would prevent harm to the community … and prevent loss of data regarding the effectiveness of teen pregnancy prevention.”

The suit asked Rice to reverse the decision by HHS Secretary Alex Azar to cut grant funding to the pregnancy prevention program, which was supposed to continue until 2020.

The suit was joined by Planned Parenthood affiliates in Alaska, Hawaii, Iowa, North Carolina, South Carolina, Louisiana, Texas and Nebraska. The decision marked the second time a federal judge found in favor of Planned Parenthood’s arguments, following a ruling last week in Washington, D.C.

“Research doesn’t happen overnight. This was set up as a five-year program,” said attorney Nathan Castellano, arguing on behalf of Planned Parenthood. “Pulling the plug on these programs is extreme. It causes irreparable harm. Teens won’t get the benefit of the program, and the general public won’t get the benefit of the research.”

The federal agency in July informed recipients of 81 teen pregnancy prevention grants that it would be terminating their grant agreements two years early, despite previously advertising and seeking competitive bids for a firm to conduct the five-year study.

Jonathan Jacobson, a Department of Justice attorney based in Washington, D.C., argued Tuesday in Spokane that HHS had discretion to end the program at any time.

“The plaintiffs are here claiming legal rights they do not have,” Jacobson told Rice. The agreement language is clear “there is no legal entitlement to further funding beyond each funding year. It’s the agency’s discretion.”

Judge Rice pelted Jacobson with several questions about the agreement, which clearly called for a five-year project and a “period of performance” from 2015 to 2020.

“I went through your brief and looked for justification for not continuing the award. I just want to know what the agency is saying,” Rice said. “Is that the language you hang your hat on: ‘The continued best interest of the federal government?’ ”

Rice, who also denied a government motion to dismiss the case, noted that the regulations written by the agency listed three ways to terminate the project. “It doesn’t include the best interest of the government.”

Jacobson said Planned Parenthood argues that HHS officials “have to continue to throw money their way … regardless of science change.”

While he didn’t explain in court what he meant by “science change,” Carrie Flaxman, a staff attorney for Planned Parenthood Federation of America, said she believes the move signals a shift in sex education policy under Trump.

“The Trump administration is clearly trying to push their abstinence-only agenda,” said Flaxman, who is based in Washington, D.C.

According the suit, the Teen Pregnancy Prevention Program has served about 1.2 million youths in 39 states and the Marshall Islands to date. That includes about 40,000 youths in Washington and Idaho.

The suit also said that since its inception in 2010 through 2016, the teen birth rate in the United States has dropped by 41 percent.

HHS cut the funding to the 81 programs a month after Trump appointed Valerie Huber as chief of staff for the Office of Assistant Secretary of Health.

After her appointment last year, Huber wrote an opinion piece decrying the lack of federal funding for abstinence education and questioned the effectiveness of teen pregnancy prevention grants as “so-called comprehensive sex education.”

She claimed, according to the lawsuit, that the TPP program “normalizes teen sex.”

Rice asked Jacobson, the DOJ attorney, if the government was arguing that the TPP program was producing “negative results.”

Jacobson answered by saying that judges generally are “loath to get involved in these core administrative decisions.”

“It is incomprehensible for them to argue for continued funding,” Jacobson said. “A government agency can’t act beyond the scope. Otherwise, we are handcuffed and the agency can’t cease funding during a five-year agreement.”

Flaxman said Jacobson “clearly struggled to come up with an explanation on why to terminate the program. Certainly, we think it’s clear under the regulations that they cannot terminate grants in the middle of the program.”

The project was set out for five years of research to gauge its effectiveness, Flaxman said.

“To be clear, these were programs that were working that were providing young people in this community, and across the country, with information they need to protect themselves and plan their lives,” she said.