The U.S. Supreme Court narrowed the scope under which the federal government can strip naturalized Americans of their citizenship on Thursday, ruling that false statements made during the naturalization process had to be relevant to gaining citizenship in order to justify revoking it later.

Justice Elena Kagan, writing for a unanimous Court in Maslenjuk v. United States, said that using small omissions or minor lies to denaturalize immigrants went beyond what Congress authorized. “The statute it passed, most naturally read, strips a person of citizenship not when she committed any illegal act during the naturalization process, but only when that act played some role in her naturalization,” she wrote.

The Obama and Trump administrations had tried to convince the justices otherwise. The case hinged on a provision of federal immigration law, Section 1425(a). If a jury finds a naturalized American guilty of an offense under 1425(a), he or she is automatically stripped of their citizenship. In 2013, federal prosecutors charged Diana Maslenjuk, the plaintiff in the case, with making false statements about her husband’s membership in Bosnian Serb militias in the 1990s.

Since the Supreme Court’s landmark Afroyim v. Rusk decision in 1967, American citizenship is generally irrevocable unless its bearer explicitly chooses to forsake it. No lawful method exists to involuntarily strip a native-born American of citizenship; naturalized citizens can lose it against their will only if they lied during the naturalization process. Maslenjuk qualified under that exception, according to federal prosecutors, when she misled a State Department official in 1998 during her application for refugee status.

The United States granted her that status in 1999 and she and her children emigrated to Ohio; her husband soon followed. After the U.S. government discovered the truth and arrested her husband in 2006 for lying about his service, Maslenjuk applied for citizenship. On the application form, she marked “no” twice when asked if she had given false information to American consular officials to gain entry to the United States. Her application was approved the following year.

The government argued at Maslenjuk’s trial that lying about her husband’s participation in the ethnic civil wars that wracked the Balkans in the 1990s helped her get refugee status. That status, prosecutors argued, was a precursor to her eventual application for citizenship in 2013. Maslenjuk countered that her omission in 1998 was immaterial to her application for refugee status. Because she reasonably feared persecution as an ethnic Serb in Muslim-majority Bosnia, she argued she already qualified for the program. The trial judge sided with prosecutors and told jurors her statement didn’t have to be material to her citizenship to qualify under 1425(a).

When Maslenjuk appealed her case to the Supreme Court, the justices saw disturbing implications from the government’s logic. Chief Justice John Roberts asked the government during oral arguments in May if lying about a speeding ticket 30 years earlier would be grounds for denaturalization. Assistant Solicitor General Robert Parker replied yes. “Oh, come on,” Roberts scoffed. Other justices followed up with more hypotheticals, and Justice Anthony Kennedy eventually told Parker that the government’s argument “is demeaning the priceless value of citizenship.” Kagan reiterated those same themes in her majority opinion on Thursday.

“Suppose, for reasons of embarrassment or what-have-you, a person concealed her membership in an online support group or failed to disclose a prior speeding violation,” she hypothesized. “Under the government’s view, a prosecutor could scour her paperwork and bring a §1425(a) charge on that meager basis, even many years after she became a citizen. That would give prosecutors nearly limitless leverage—and afford newly naturalized Americans precious little security.”

Kagan noted that such a reading of the law could create paradoxical situations for would-be Americans seeking citizenship. She pointed out that federal immigration law only allows false statements to be used to deny citizenship applications if they are made “for the purpose of obtaining [immigration] benefits”—not if they are made simply out of shame or error. “But under the government’s reading of §1425(a), a lie told in the naturalization process—even out of embarrassment, fear, or a desire for privacy—would always provide a basis for rescinding citizenship,” Kagan observed. “The government could thus take away on one day what it was required to give the day before.”

Whether Maslenjuk will be able to keep her citizenship is unclear. Her case now returns to the lower courts for retrial in front of a properly instructed jury, which could still conclude her misstatements were material to her citizenship application and convict her again under 1425(a). If they do, her citizenship would face revocation for a second time.

But the ruling’s full impact extends beyond her specific case. The unanimous decision comes as the Trump administration ramps up enforcement of immigration laws nationwide, putting into practice the hardline stance that propelled President Trump to the Oval Office. Had the Court ruled the other way, it could have opened the doors for federal prosecutors to imperil the citizenship of tens of thousands of Americans for innocuous errors made decades earlier. By foreclosing that possibility, the Court strengthened American citizenship and the protections it brings.