A U.S. judge blocked a Trump administration policy that for months has allowed federal agents to rapidly remove undocumented immigrants without due process from anywhere in the U.S. if they can’t quickly prove they’ve been in the country for more than two years.

The decision Friday puts on hold a rule enacted in January that has become a key element of President Donald Trump’s mass deportation effort. The rule expanded a policy known as "expedited removal,” which had long been used only for immigrants caught near the U.S. border and only if they’d been in the country for a few weeks or less.

The new policy allowed such removals to be carried out from anywhere in the U.S. and to anyone who’s been in the country for less than two years. But the expedited-removal process has always left too much room for error, U.S. District Judge Jia Cobb said in the ruling, including the rapid deportation of individuals who have legitimate reasons to remain in the U.S.. Expanding the policy only allows room for more errors, possibly irreversible ones, she said.