A federal judge on Wednesday dismissed Justice Department policies that made it harder for immigrants to claim asylum because of domestic violence or gang violence, finding the policies violated existing law.

Judge Emmet Sullivan of the U.S. District Court in Washington ruled the harsher Justice Department policies ordered by former U.S. Attorney General Jeff Sessions were "arbitrary, capricious and in violation of the immigration laws."

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 in his 107-page decision.

He permanently blocked the government "from continuing to apply those policies and from removing plaintiffs who are currently in the United States without first providing credible fear determinations consistent with the immigration laws," and ordered the feds "to return to the United States the plaintiffs who were unlawfully deported and to provide them with new credible fear determinations consistent with the immigration laws."

The ruling was hailed by the American Civil Liberties Union, which had challenged DOJ's "expedited removal" policies in court.

“This ruling is a defeat for the Trump administration’s all-out assault on the rights of asylum seekers. 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,” said Jennifer Chang Newell, managing attorney of the ACLU’s Immigrants’ Rights Project, who argued the case.

The White House responded in a statement from the press secretary saying: "Under the law, asylum is a discretionary benefit for aliens who have a well-founded fear of persecution on account of their race, religion, nationality, political opinion, or membership in a particular social group."

The decision Wednesday undermines U.S. law, the statement said, and will "encourage more illegal immigration to the United States."

The administration's asylum policies were announced by then-Attorney General Jeff Sessions, who said in June that fear of domestic abuse or gang violence is not an acceptable basis for granting asylum.

"The asylum statute does not provide redress for all misfortune," Sessions wrote. "The mere fact that a country may have problems effectively policing certain crimes — such as domestic violence or gang violence — or that certain populations are more likely to be victims of crime cannot itself establish an asylum claim."

Justice Department spokesman Steven Stafford said, "We are reviewing our options with regard to this ruling, and we will continue to restore the rule of law in our immigration system."

Trump administration officials say the asylum process is being exploited by immigrants who are counting on passing the initial credible-fear screening and being released into the country. Only about nine percent of all people who initially claim asylum are granted it, and tens of thousands of families from Central America are coming to the U.S. every month.

The ACLU filed suit on behalf of a dozen asylum seekers, all of whom had experienced horrors in the homelands, and all of whom were deemed "credible" by asylum officers. Under the new guidelines, however, they did not meet the criteria for a "credible fear of persecution" in their home countries and were slated for "expedited removal."

Sullivan's ruling allows the plaintiffs to continue to seek asylum through court proceedings in the U.S., and orders any who were deported before the order to be returned.

The Justice Department asked the judge in a court filing Wednesday to stay his ruling as it would apply to asylum seekers who are not involved with the lawsuit while it decides whether to appeal the order. "One reason for this is the importance of applying consistent and readily discernable policies within the expedited removal system—should this Court’s decision not hold up on appeal, it would result in changing and confusing alterations of the policies needed to screen tens of thousands of aliens arriving at our borders," the filing said.

In the same case in August, an angry Sullivan rapped the Justice Department for having deported a mother and daughter, who were plaintiffs, back to El Salvador. The mother had fled "horrific" sexual abuse at the hands of her husband, and death threats from a local gang. Sullivan ordered the feds to turn her plane back around, and not to deport any other plaintiffs while the case was pending.

The decision is part of an eventful week for the federal judge. He presided over a sentencing hearing for former national security adviser Michael Flynn, where he blasted the ex-military man for lying to federal investigators. He eventually delayed the sentencing.