BOSTON — A judge ordered federal emergency officials to extend vouchers for temporary hotel housing for nearly 1,700 Puerto Rican hurricane evacuees, saying ending the program could cause irreparable harm.

Saturday night’s decision came shortly after civil rights group LatinoJustice PRLDEF filed a lawsuit seeking relief for the Puerto Ricans, whose federal housing assistance vouchers were due to expire at midnight Sunday, meaning the evacuees could have been evicted from the hotels.

The order says the agency cannot end its Transitional Sheltering Assistance program until at least midnight Tuesday. The organization is pushing to let families stay another six months.

U.S. District Judge Leo Sorokin of Massachusetts wrote that ending the program would drain other public resources. He also said the evidence showed problems with the Federal Emergency Management Agency’s efforts to notify and provide transitional help for the hurricane refugees.

“The irreparable harm to the plaintiffs is obvious and overwhelming; tomorrow morning they will be evicted and homeless since by definition each plaintiff’s home was rendered uninhabitable by the hurricane in Puerto Rico,” he wrote in his decision.

FEMA declined to comment on the lawsuit, but the Orlando Sentinel reported the agency confirmed it was working to notify hotels to extend the aid until July 5 to comply with the order. A spokeswoman also said the agency was extending transportation aid until Aug. 30 to cover travel costs for families who wish to return to the island.

Keith Turi, a FEMA administrator for the program, said in a video that the agency is working with state and local officials and volunteer organizations to find assistance for the evacuees and will help pay for a flight home.

Craig J. de Recat, a partner with Manatt, Phelps & Phillips, the law firm working pro bono with LatinoJustice on the suit, said evacuees had not been informed properly of the end of the program. He said most evacuees found out about the termination of housing from their hotels, or from watching television – not directly from FEMA.

He said a hearing is planned for Monday to see if the restraining order should be extended.

One of its occupants, 49-year-old Lizbeth Cruz, said she’s not going back to Puerto Rico, saying she doesn’t trust the government to deal with another disaster. She didn’t know about the FEMA aid so she paid out of pocket for her hotels.