Updated

A federal appeals court handed the Trump administration another defeat over its revised travel ban Thursday, ruling that grandparents, cousins and similarly close relations of people already in the U.S. should not be prevented from coming to the country.

The unanimous decision by the 9th Circuit Court of Appeals upheld an earlier ruling by a federal judge in Hawaii who found the administration’s view too strict.

“Stated simply, the government does not offer a persuasive explanation for why a mother-in-law is clearly a bona fide relationship, in the Supreme Court’s prior reasoning, but a grandparent, grandchild, aunt, uncle, niece, nephew, or cousin is not,” the ruling said.

The appeals panel wrote that under typical court rules, its ruling would not take effect for at least 52 days. But in this instance, the judges said, many refugees would be "gravely imperiled" by such a delay, so the decision will take effect in five days.

"Refugees' lives remain in vulnerable limbo during the pendency of the Supreme Court's stay," they wrote. "Refugees have only a narrow window of time to complete their travel, as certain security and medical checks expire and must then be reinitiated."

The Justice Department said it would appeal.

"The Supreme Court has stepped in to correct these lower courts before, and we will now return to the Supreme Court to vindicate the executive branch's duty to protect the nation," the agency said in a statement.

The Supreme Court said in June that President Donald Trump’s 90-day ban on visitors from Iran, Libya, Somalia, Sudan, Syria and Yemen can be enforced pending arguments scheduled for October. But the justices said it should not apply to visitors who have a “bona fide relationship” with people or organizations in the U.S., such as close family ties or a job offer.

The government interpreted such family relations to include immediate family members and in-laws, but not grandparents, cousins, aunts and uncles. The judge in Hawaii overruled that interpretation, expanding the definition of who can enter the country to the other categories of relatives.

The appeals court also upheld the Hawaii judge's ruling that refugees from those countries who had been accepted by a resettlement agency should not be subject to the ban.

Lawyers for the government and the state of Hawaii, which challenged the revised travel ban, argued the case in Seattle last week.

Deputy assistant attorney general Hashim Mooppan ran into tough questions as soon as he began arguing the government’s case, with Judge Ronald Gould asking him from “what universe” the administration took its position that grandparents don’t constitute a close family relationship.

Judge Richard Paez similarly questioned why an in-law would be allowed in, but not a grandparent.

“Could you explain to me what’s significantly different between a grandparent and a mother-in-law, father-in-law?” Paez asked. “What is so different about those two categories? One is in and one is out.”

Mooppan conceded that people can have a profound connection to their grandparents and other extended relatives, but from a legal perspective, the administration had to draw the line somewhere to have a workable ban based largely on definitions used in other aspects of immigration law, he said.

Hawaii is also one of 15 states that sued the Trump administration Wednesday over its plans to end the Deferred Action for Childhood Arrivals program that protects young immigrants from deportation.

"Today's decision by the 9th Circuit keeps families together. It gives vetted refugees a second chance," state Attorney General Douglas Chin said in a statement. "The Trump administration keeps taking actions with no legal basis. We will keep fighting back."

Fox News' Mike Lundin and The Associated Press contributed to this report.