President Donald Trump’s administration on Monday won its bid to throw out a ruling that had allowed illegal immigrants held by the government to get taxpayer-paid abortions, but the Supreme Court declined to penalize lawyers for alleged dishonesty.

The case arose from a lawsuit filed by the American Civil Liberties Union (ACLU) on behalf of a pregnant teenager who crossed the border illegally last year. The ACLU argued the girl should have access to an abortion clinic. A federal judge in the District of Columbia agreed, and ruled in favor of the ACLU on its class-action lawsuit on behalf of all detained illegal immigrant women.

The Supreme Court, in an unsigned opinion on Monday, ruled that the case was “moot” because the girl already had obtained the abortion. The justices sent the case back to the D.C. Circuit Court with orders to instruct the trial court judge to dismiss the individual claims.

By throwing out the class-action suit, it saves the government from an adverse ruling that could have served as a precedent.

Texas Attorney General Ken Paxton, who had warned that his state could become a “sanctuary state” for illegal immigrants looking for abortions, praised Monday’s ruling.

“The Supreme Court made the right decision to vacate the D.C. Circuit’s ruling creating a right to abortion for anyone who enters the U.S. illegally,” he said in a statement. “The previous ruling not only cost a life, but could [also] have paved the way for extending American citizens’ rights to all unlawfully present aliens with no substantial connection to this country. Texas will not become a sanctuary state for abortions, and will continue the fight to protect and promote fetal life.”

The high court declined to sanction ACLU lawyers, whom the government accused of acting unethically.

Related: Trump Asks High Court to Block Illegal Immigrant Girl’s Abortion

The court schedule had been set with the understanding that the girl had an appointment on October 25 of last year at an abortion clinic. But the appointment got moved up, and the girl obtained the abortion at 4:15 in the morning — before the government could appeal the initial decision.

In deciding not to order sanctions, the justices seemed to strike a middle ground.

Who do you think would win the Presidency?

By completing the poll, you agree to receive emails from LifeZette, occasional offers from our partners and that you've read and agree to our privacy policy and legal statement.

“The Court takes allegations like those the Government makes here seriously, for ethical rules are necessary to the maintenance of a culture of civility and mutual trust within the legal profession,” the justices wrote.

“On the one hand, all attorneys must remain aware of the principle that zealous advocacy does not displace their obligations as officers of the court. Especially in fast-paced, emergency proceedings like those at issue here, it is critical that lawyers and courts alike be able to rely on one another’s representations. On the other hand, lawyers also have ethical obligations to their clients, and not all communication breakdowns constitute misconduct.”

PoliZette senior writer Brendan Kirby can be reached at [email protected]. Follow him on Twitter.