WASHINGTON (AP) — The Justice Department on Tuesday reversed its own legal opinion and said it would allow federal inmates released on home confinement because of the coronavirus pandemic to stay out of prison.

The decision announced by Attorney General Merrick Garland came after months of pressure on President Joe Biden from criminal justice groups, lawmakers and other advocates. In the final days of the Trump administration, DOJ said released inmates would have to return to prison at the end of the emergency period declared during the pandemic. Nearly 3,000 former inmates would have potentially been taken back to prison.

DOJ’s Office of Legal Counsel said Tuesday that it did not “lightly depart from our precedents, and we have given the views expressed in our prior opinion careful and respectful consideration.”

The office concluded that the Federal Bureau of Prisons’ “preexisting authorities does not require that prisoners in extended home confinement be returned en masse to correctional facilities when the emergency period ends.”

The original releases was authorized under the authority of the $2.2 trillion CARES Act that former President Donald Trump signed in March 2020. As the virus spread, then-Attorney General William Barr directed federal prisons to increase the use of home confinement and expedite the release of eligible high-risk inmates as coronavirus cases surged, particularly in detention settings. Priority was given to those at low- or medium-security prisons where the virus was spreading fastest.

“Thousands of people on home confinement have reconnected with their families, have found gainful employment, and have followed the rules,” Garland said in a statement. “In light of today’s Office of Legal Counsel opinion, I have directed that the Department engage in a rulemaking process to ensure that the Department lives up to the letter and the spirit of the CARES Act.”

Garland added: “We will exercise our authority so that those who have made rehabilitative progress and complied with the conditions of home confinement, and who in the interests of justice should be given an opportunity to continue transitioning back to society, are not unnecessarily returned to prison.”

More than 35,000 inmates were released as part of the effort to ease pandemic conditions as long as they met certain criteria, including they were not likely a danger to others. But 2,830 of the 4,879 people who remain on home confinement were slated to return to prison, the BOP said. The others have completed their sentences.

Garland called advocates Tuesday prior to the announcement.

“This is excellent news for thousands of people and their families to get before the holidays,” Families Against Mandatory Minimums President Kevin Ring said in a statement. “There is no way the people on CARES Act home confinement should have been sent back to prison, and we are very grateful to the Biden administration for fixing this mistake.”