A federal judge in Maryland has blockedthe Trump administration's executive order allowing state and local governments to turn away refugees from resettling in their communities.

In September, President Trump announced that groups that help refugees find places to live must first get written consent from local and state jurisdictions before resettling them.

Immigration advocates challenged the executive order in federal court, calling it cruel and short-sighted.

In his ruling issued Wednesday, U.S. District Judge Peter Messitte wrote that the executive order "does not appear to serve the overall public interest."

In his 31-page opinion, he wrote that the order gives states and local governments "the power to veto where refugees may be resettled – in the face of clear statutory text and structure, purpose Congressional intent, executive practice, judicial holdings and Congressional doctrine to the contrary."

Messitte's ruling is a preliminary injunction, putting on hold enforcement of Trump's refugee resettlement order.

Lawyers for the three advocacy groups that went to court over the issue, Church World Service, Lutheran Immigration and Refugee Service and HIAS, said in the lawsuit that Trump's move violated the Refugee Act of 1980, which declares that it is a policy of the U.S. to encourage refugees fleeing persecution to be resettled in America.

"The objectives of this Act are to provide a permanent and systematic procedure for the admission to this country of refugees of special humanitarian concern to the United States, and to provide comprehensive and uniform provisions for the effective resettlement and absorption of those refugees who are admitted," Messitte wrote.

Trump's executive order, the judge wrote, appears to run counter to the Refugee Act.

"This ruling shows the country how this administration was wrong to attempt a state-by-state refugee ban," said Mark Hetfield, president and CEO of HIAS."An overwhelming majority of governors and municipalities have already expressed their desire to continue welcoming refugees. To those few who have not, we say not only is it unkind and un-American to ban refugees from your states and towns, but it is unlawful."

Texas recently announced it would become the first state to reject refugees since Trump issued the executive order.

"Texas has been left by Congress to deal with disproportionate migration issues resulting from a broken federal immigration system," Gov. Greg Abbott said in a letter released last week.

The Trump administration haslimited that the number of refugees allowed to resettle in the U.S. this fiscal year to 18,000, down from the administration's previousceiling of 30,000.

The latest cap marks the lowest number of refugees seeking protection from violence or political persecution that will be allowed into the country since the modern refugee program was established in 1980.

Copyright 2020 NPR. To see more, visit https://www.npr.org.