President Donald Trump argues about border security with Senate Minority Leader Chuck Schumer (D-NY) in the Oval Office on December 11, 2018 in Washington, DC.

A federal judge on Wednesday struck down a Trump administration policy that made it more difficult for victims of domestic abuse and gang violence to claim asylum, and ordered the government to return to the United States any plaintiff in the case who was deported.

In June, former Attorney General Jeff Sessions issued a legal opinion finding that domestic abuse and gang violence were not permissible grounds for asylum claims, saying at the time that "the asylum statute is not a general-hardship statute."

U.S. District Court Judge Emmet Sullivan struck down the restrictive policy in an order that declared that the rules broke with longstanding federal and international laws.

"And because it is the will of Congress — not the whims of the Executive — that determines the standard for expedited removal, the Court finds that those policies are unlawful," Sullivan wrote.

The plaintiffs who brought the case, who were represented by the American Civil Liberties Union and the Center for Gender & Refugee Studies, include 12 adults and children who told U.S. asylum officers that they were victims of sexual abuse, kidnappings and beatings in their home countries.

They were denied asylum in the United States despite a finding that their fears were sincere. Under the rules established in June, the officers determined that they did not meet the standard of having a credible fear of persecution.

The ACLU trumpeted Sullivan's decision in a statement on Wednesday blasting the administration.

"This ruling is a defeat for the Trump administration's all-out assault on the rights of asylum seekers," said Jennifer Chang Newell, managing attorney of the ACLU's Immigrants' Rights Project, who argued the case. "The government's attempt to obliterate asylum protections is unlawful and inconsistent with our country's longstanding commitment to provide protection to immigrants fleeing for their lives."

Sullivan's ruling is likely to be appealed by the Trump administration. Shortly after it was filed, the Justice Department asked Sullivan to stay his ruling pending a decision by the government about whether to appeal, and, if it does, through the duration of the appeals process.

Wednesday's ruling is the latest development in what became a dramatic legal battle.

During an August court hearing over whether Sullivan would temporarily halt the Trump administration policy, the judge learned that the government had earlier that morning put two women on a flight back to El Salvador. The women said they had fled sexual abuse in the country, including rape, stalking and death threats.

Sullivan ordered the government to "turn the plane around."

The ruling comes one day after Sullivan made news by castigating Trump's former national security advisor Mike Flynn, who appeared before Sullivan on Tuesday in an unrelated hearing. Sullivan told Flynn that "arguably you sold your country out" and at one point suggested that he might be guilty of "treason," though he later walked those comments back.