Puerto Ricans who fled Hurricane Maria’s devastation and have been living in temporary housing on the mainland were granted a reprieve Saturday night when a federal judge temporarily blocked the government from ending an assistance program that was set to expire.

U.S. District Judge Leo T. Sorokin of Massachusetts ordered that the Federal Emergency Management Agency cannot end its Transitional Sheltering Assistance (TSA) program until at least midnight Tuesday, meaning those depending on the aid to pay for hotel and motel rooms should be able to stay at least until check-out time Wednesday, according to online court records.

The national civil-rights group that filed a lawsuit Saturday seeking the restraining order said the end of the FEMA assistance would lead to Puerto Rican evacuees being evicted. The temporary restraining order affects around 1,744 people, an attorney involved in the suit said. The FEMA transitional assistance was to end Saturday.

"Basically there’s a bunch of people who may be in bed now who think they have to move tomorrow. They can wake up tomorrow knowing they have a roof over their head for at least two more days," Christiaan Perez, manager of advocacy and digital strategy for the civil-rights group, LatinoJustice PRLDEF, said Saturday night.

The judge scheduled a telephone hearing for Monday.

FEMA said in a statement Sunday that it was "aware" of the judge's order and was working with its vendor and notifying hotels and extending the program through Thursday. FEMA said it would not comment on pending litigation beyond that.

The agency added that it was extending for an additional 60 days a transportation assistance program that covers the costs of airfare, luggage and pet fees for Puerto Ricans to return to the island.

Hurricane Maria struck Puerto Rico in September, destroying homes and infrastructure, and researchers have estimated that more than 4,500 people may have died in the storm and its aftermath.

::Breaking News:: Puerto Ricans living on Temporary Shelter Assistance (TSA) because of Hurricane Maria will not be evicted tomorrow! Thank you everyone who helped make this happen! Please make sure your networks know that 1,744 Puerto Ricans will not be evicted #JustRecovery — LatinoJustice PRLDEF (@latinojustice) July 1, 2018

Many of the families who left for the mainland U.S. have been living in hotels in New York and Florida and those who have not been able to secure affordable housing worried about what would come next as the end of the FEMA assistance program loomed.

"I don't know what's going to happen. The city called me and said there’s a shelter but there’s no guarantee, they didn't say everything is going to be OK," Cynthia Beard, one of the 600 Puerto Rican hurricane survivors living in New York, told NBC News this week.

According to Mayor Bill de Blasio's office, New York City has a program in place to direct transportation from the hotels to the shelters. Once there, families have to see if they are deemed eligible to register into the city’s shelter system. If accepted, families get assigned to case management and housing assistance services to help them find permanent homes.

Beard knows this process all too well. When she first landed in New York with her two kids — ages 2 and 4 — back in November, Beard waited many days outside the Prevention Assistance and Temporary Housing (PATH) facility in the Bronx to be approved to stay there. She was never able to get in.

"What if they don’t accept me again?" said Beard, 25, who works in a Banana Republic store in Brooklyn and in the city’s Transit Adjudication Bureau as a cashier. Despite working two jobs, she and her family have not been able to access affordable housing in the area.

To spare her kids from the uncertainty and the shelter system, Beard sent them back to Puerto Rico a week ago to stay with their grandparents while she figures out ways to get a permanent home before her children return from Puerto Rico on Aug. 25.

FEMA gave Puerto Ricans like Beard the option to return to Puerto Rico.

"I did consider it but I get frustrated because I think that at least if I'm on the streets here, there are shelters, but in Puerto Rico, if you’re on the street, you’re on the street," Beard said.

Cynthia Beard (far right), with her kids and her husband in New York. Courtesy: Cynthia Beard

According to FEMA, they called more than 1,500 displaced Puerto Ricans to offer to pay for their plane tickets to return to Puerto Rico before July 1 or recommend them ways to look into their state’s shelter system.

As of June 27, only 145 families had either booked their plane tickets or already returned to Puerto Rico. But most families decided to stay even though many don’t have a permanent home.

"I have a job here and there are also better schools for the kids," said Beard, who was one of the many people that declined FEMA's offer. "There is really no choice."

Puerto Rico is still recovering from the devastating hurricane as well as still reeling from a decades-long financial crisis.

Over 130 families are already in the process of applying to NYC housing or are already in the shelter system, according to the Mayor De Blasio’s office.

In Florida, Maria Baez, another displaced Puerto Rican living in Florida with her grandson, got the same call from FEMA last week. Baez declined their offer to return to Puerto Rico.

She said her 5-year-old grandson Christian Dariel, who has cerebral palsy and needs full-time care, is scheduled to undergo medical procedures soon and doesn't want to risk her grandson's life.

Maria Baez and Christian Dariel, a Puerto Rican family who was living in Florida under FEMA's Transitional Shelter Assistance program. Nirma Hasty / NBC News

"There are days that I get really depressed," said Baez about her grandson's situation. "I want to do more for him and I feel like my hands are tied up."

Baez said she has done everything in her power to find a permanent home in Orlando, Florida since she arrived in November. She applied for multiple low-income apartment complexes in her area and is working with a case manager from a local Methodist church to help her look into other permanent housing options.

The biggest obstacle that hundreds of displaced Puerto Ricans like Baez face when trying to find housing is a lack of affordable rentals in Central Florida.

The office of Senator Victor Torres, D-Fla., who represents Orange and Osceola county in Central Florida, called multiple affordable housing places in an effort to help these families before the TSA program was scheduled to end.

"Just the other day I was making calls to these places. Out of 10 affordable housing apartments, nine had nothing available,” Lurimar Cruz, a spokesperson from Torres' office told NBC. "The waiting lists for these places are between 8 to 12 months.”

The Orlando-Kissimmee metropolitan area ranks third in the country for its lack of affordable rentals, according to the National Low Income Housing Coalition’s (NLIHC) 2018 GAP report.

"These families are going to end up in the streets, living in their cars if we don't do something," Torres told NBC. “Many of these people are elderly, people with disabilities. What they need is help."

For now, Baez is hopeful that she will be able to find permanent housing in the next month or so thanks to the help from community members and some public officials.

"A community organization was able to help pay for three more nights in the hotel,” Baez told NBC. “Right now, I hear some congressmen saying that my application for affordable housing might get priority. Hopefully I’m able to hear back before next month."

If Baez is not able to stay in the hotel after the three days go by, she has a friend who’s willing to take her and Christian Dariel in the meantime.

After four different deadline extensions, FEMA's TSA program housed Puerto Rican hurricane survivors for nearly nine months. During other disasters, survivors participated in the TSA program for a year and a half — even though officials have said that the program normally lasts 30 days.

FEMA said this week that it was ending Transitional Sheltering Assistance for survivors of hurricanes Maria, Irma and Harvey on Saturday. The agency said it has spent more than $432 million on survivor lodging as part of the program, and that it has provided rental assistance to more than 25,000 TSA participant families to help them find permanent housing.

A spokesperson for FEMA said earlier Saturday after LatinoJustice PRLDEF filed the lawsuit that the agency does not comment on pending legal matters.

Attorney Craig J. de Recat of Manatt, Phelps & Phillips LLP, which worked with LatinoJustice on the Saturday’s lawsuit, said that the ultimate fate of the FEMA assistance will be decided in further proceedings.

"It's a constitutional challenge that these people, who are citizens of the United States, who are entitled to receive what's been given to others," de Recat said. "FEMA has certain procedures and requirements we don’t believe they've met, and we're going to have a judge decide."

FOLLOW NBC LATINO ON FACEBOOK, TWITTER AND INSTAGRAM.