A U.S. appeals court Monday allowed President Donald Trump’s newest version of the travel ban to partially take effect.

The 9th U.S. Circuit Court of Appeals ruling will bar people from six Muslim-majority countries included in the travel ban who do not have a “bona fide” relationship with a person or entity in the U.S. from entering the country. The ban can’t be enforced against people who have those relationships.

Hawaii sued to stop the latest ban, which was announced in September.

Hours before it was set to take full effect last month, U.S. District Judge Derrick Watson in Hawaii issued a ruling blocking the ban. Watson found that the new ban, like the version before it, failed to show that nationality alone makes a person a greater security risk to the U.S.

The policy applied to travelers from Chad, Iran, Libya, North Korea, Somalia, Syria and Yemen plus some Venezuelan government officials and their families.

Rulings against the ban in Hawaii and later in Maryland apply only to the six Muslim-majority countries. They did not affect the restrictions against North Korea or Venezuela, because the plaintiffs did not ask for that. The Maryland ruling was narrower than the Hawaii one in that it allowed enforcement against those with no U.S. ties.

The U.S. government appealed, saying the rulings thwarted Trump’s efforts to keep the American people safe.

The 9th Circuit in San Francisco had blocked previous versions of the ban.

“We are reviewing the court’s order and the government will begin enforcing the travel proclamation consistent with the partial stay,” U.S. Department of Justice spokeswoman Lauren Ehrsam said in a statement. “We believe that the proclamation should be allowed to take effect in its entirety.”

The appellate judges adopted language that the Supreme Court itself either wrote or blessed when it considered legal challenges to the previous version of the travel ban.

In June the justices said the travel ban could not keep out of the country people who could claim a bona fide relationship with someone or a group in the U.S.

The justices did not list precisely what kinds of relationships were covered, but they left in place a subsequent 9th Circuit ruling that protected grandparents, cousins and other relatives.

Monday’s ruling spells out that the “close family relationship” includes grandparents, grandchildren, brothers-in-law, sisters-in-law, aunts, uncles, nieces, nephews and cousins.

The ruling “closely tracks guidance previously issued by the Supreme Court,” state Attorney General Doug Chin said in a statement. “I’m pleased that family ties to the U.S., including grandparents, will be respected. We continue to prepare for substantive arguments before the 9th Circuit on Dec. 6 in Seattle.”