Puerto Ricans who fled Hurricane Maria’s devastation and have been temporarily housed in motels and hotels on the mainland were granted a 20-day extension, a federal judge ruled on Tuesday.

After a telephone hearing conducted on Monday, U.S. District Judge Timothy Hillman of Massachusetts extended FEMA's Temporary Shelter Assistance (TSA) program to July 23. The program has housed about 1,700 Puerto Rican evacuees. Many families have been struggling to get access to permanent housing in areas where there is a lack of affordable rentals and crowded shelter systems.

The decision comes after a different judge, U.S. District Judge Leo T. Sorokin of Massachusetts, blocked FEMA from ending the program on Saturday, TSA's original end date.

Sorokin’s halt is the result of a lawsuit filed on Saturday by LatinoJustice PRLDEF, a national civil rights group, which filed a restraining order to stop FEMA from ending the program.

“We decided to file the lawsuit when we saw that nothing was being done,” Kira Romero Craft, one of the attorneys in the case, told NBC News.

“We don’t understand why officials from the federal government didn’t come together and acknowledge that there’s a real crisis here. They have had the time to think about this and come up with a solution,” Romero Craft added.

In his ruling, the judge found that "further briefing on the issues would be helpful to the Court." He requested both parties to address "the

implication of the refusal of the Governor of Puerto Rico to request an extension of the TSA program benefits" before July 18. pic.twitter.com/6X2QkcvIcb — Nicole Acevedo (@Nicolemarie_A) July 3, 2018

In Tuesday's ruling, Judge Hillman said that "further briefing on the issues would be helpful to the Court” and requested both parties address their positions in writing before July 18.

The judge expects to issue a final order by July 23 to determine whether there will be further extensions to the FEMA program or if a formal hearing needs to be scheduled later this summer to allow testimonies and present more evidence before he makes a final decision, Natasha Lycia Ora Bannan, associate counsel at LatinoJustice PRLDEF, clarified to NBC News.

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.

Many of the families who left for the mainland U.S. have been living in hotels in New York, Massachusetts, Florida and other states.

According to the lawsuit, FEMA decided to end the program on Saturday without a comprehensive plan to help transition families into long-term housing. Lawyers argued the agency and other federal authorities have not exhausted all the options available to aid these families, including arranging an inter-agency agreement with the Department of Housing and Urban Development (HUD) to start a Disaster Housing Assistance Program (DHAP), as the agency did after Hurricane Katrina and Hurricane Sandy.

:: Breaking :: Judge Extends FEMA Aid for Puerto Ricans Pending Formal Hearing! Puerto Rican families have housing until at least July 23rd when we are hoping to convince the judge to hold FEMA accountable for our community! #Boricua #JustRecovery — LatinoJustice PRLDEF (@latinojustice) July 3, 2018

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

Attorney Craig J. de Recat of Manatt, Phelps & Phillips LLP, who worked with LatinoJustice PRLDEF on the lawsuit said it was a constitutional challenge since U.S. citizens "are entitled to receive what's been given to others."

Peter Gudaitis, executive director of the New York Disaster Interfaith Services (NYDIS), an organization that’s been helping displaced Puerto Ricans said that while he welcomes Judge Hillman’s ruling, it doesn’t solve the root of the problem because families still lack permanent housing options.

“It helps, but it's kicking the can down the road,” Gudaitis told NBC. “These are not chronically homeless families. They want home, jobs. They shouldn’t be treated this way."

According to NYDIS, 106 Puerto Rican families are still living in hotels under FEMA’s TSA program. About 900 displaced families are staying with relatives in New York City and another 230 have entered the city’s shelter system.

Cynthia Beard, one of the many Puerto Rican hurricane survivors in New York, knows the shelter process all too well. When she first landed in the city 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.

According to Gudaitis, a shortage of affordable housing has made it difficult for families to relocate in permanent housing units. Puerto Rican hurricane evacuees in Florida are also feeling this same burden, especially in Central Florida.

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. Maria Baez, who lives in a FEMA-paid hotel in this area with her disabled 5-year-old grandson, said she has done everything in her power to find a permanent home in Orlando since she arrived in November.

Baez 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.

"There are days that I get really depressed," said Baez. ”I feel like my hands are tied up."

In a statement released on Tuesday, FEMA said it will work with its vendors to comply with the latest judge order. The agency doesn't comment on pending litigations.

Statement from @fema on Court Order Extending Transitional Sheltering Assistance Program for Puerto Rico by William Booher, Public Affairs Director. pic.twitter.com/qb6SOYLwHo — William Booher (@FEMAspox) July 3, 2018

Last week, FEMA said it was ending the Transitional Sheltering Assistance for survivors of hurricanes Maria, Irma and Harvey on June 30. 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.

FOLLOW NBC LATINO ON FACEBOOK, TWITTER AND INSTAGRAM.