(Reuters) - A federal judge has blocked President Donald Trump’s administration from terminating grants issued through a teen pregnancy prevention program, marking the third time in a week that a court has held that the administration’s 2017 decision was unlawful.

U.S. District Judge Catherine Blake in Baltimore ruled on Wednesday that the U.S. Department of Health and Human Services improperly moved to terminate five-year grant awards issued to the city and a non-profit two years early.

Blake said HHS failed to comply with at least one of four conditions before it terminated the grants, such as showing that Baltimore or Healthy Teen Network failed to comply with the terms of their awards.

“Because it is undisputed that none of these four conditions was met, HHS’ action was unlawful,” Blake wrote.

She said Congress, in creating the Teen Pregnancy Prevention Program in 2010, required HHS to provide grants based on the grantees’ success in preventing teen pregnancy. Yet the agency had not shown it considered those factors.

“HHS’ decision was, therefore, arbitrary and capricious,” Blake wrote.

The ruling came in one of four lawsuits announced in February by organizations and local governments that received grants under the program, which was launched during Democratic President Barack Obama’s administration.

On Tuesday, a federal judge in Washington state blocked HHS from terminating grant funding for programs run by affiliates of Planned Parenthood.

“This is a major victory for the rule of law and evidence-based policymaking, as well as a victory for the young people of Baltimore who need more access to education, not less,” Baltimore Mayor Catherine Pugh said in a statement.

HHS did not respond to a request for comment.

Congress has appropriated about $110 million annually since 2010 for the Teen Pregnancy Prevention Program, which serves 1.2 million young people nationally.

In July, however, HHS told recipients of 81 of the five-year grants that it would terminate their agreements two years early, according to the lawsuits. Another three were terminated in September.

Among those affected was Healthy Teen Network, a non-profit that was awarded $3.6 million, and the city of Baltimore, which had been awarded $8.75 million.

Their lawsuit said the cuts followed the appointment in June of Valerie Huber, who had been an advocate for abstinence-only sex education, as chief of staff for the Office of Assistant Secretary of Health.