A federal judge on Tuesday upheld a legal challenge to the Trump administration’s rule requiring asylum seekers to request asylum in another country before coming to the United States.

Washington, D.C. District Court Judge Timothy J. Kelly,  who was appointed by Trump in 2017, ruled that the administration’s “Third-Country Asylum Rule” violated the Immigration and Nationality Act, which allows most people who have reached the U.S. border to apply for asylum, according to Axios.

The ruling is a blow to the administration’s immigration policy and comes less than a week after the Supreme Court ruled in favor of DACA (Deferred Action for Childhood Arrivals), allowing nearly 800,000 people brought to the U.S. illegally as children to stay without fear of deportation.

Kelly described the administration’s asylum rule as rendering “aliens seeking to enter the United States at its southern border categorically ineligible for asylum unless they first applied for similar protection in a third country they transited through."

SUPREME COURT SAYS TRUMP ADMINISTRATION DIDN'T PROVIDE SUFFICIENT EVIDENCE FOR CANCELING DACA

Neal Katyal, who is involved in the challenge, said the ruling goes into effect immediately.

Kelly said the U.S. Department of Justice and the Department of Homeland Security “unlawfully dispensed” with requirements in the Administrative Procedure Act (APA) and issued the rule “without observance of procedure required by law.”

The APA governs how federal agencies issue regulations and gives the public an opportunity to comment on proposed regulations.

"There are many circumstances in which courts appropriately defer to the national security judgments of the Executive," Kelly wrote. "But determining the scope of an APA exception is not one of them."

CLICK HERE TO GET THE FOX NEWS APP

The rule mainly focused on Central Americans, making them seek asylum in Mexico before coming to the U.S., according to NBC News.