In a major victory for the Affordable Care Act, a.k.a. Obamacare, the Supreme Court ruled that federal tax subsidies could be made available to people who live in states that chose not to create their own health care exchanges, The New York Times reports.

Chief Justice John Roberts wrote the majority 6–3 ruling in the case, titled King v. Burwell.

When Congress originally wrote the Affordable Care Act, it included a phrase that said subsidies would be available to people buying insurance on “an exchange established by the state.” A problem arose because not all states set up insurance exchanges; the Times reports that about three dozen states decided to let the federal government provide them. Does this mean the law does not allow the federal subsidies in these states? That’s what the Supreme Court had to decide.

“In this instance,” Roberts wrote in the ruling, “the context and structure of the act compel us to depart from what would otherwise be the most natural reading of the pertinent statutory phrase.… Congress passed the Affordable Care Act to improve health insurance markets, not to destroy them.… If at all possible, we must interpret the act in a way that is consistent with the former, and avoids the latter.”

In the dissent, as Slate reports, Justice Antonin Scalia accused the majority of “interpretive jiggery-pokery” and wrote, “We should start calling this law SCOTUScare.”

HIV advocates and people for expanding health care to all Americans have applauded the ruling. In a statement from Lambda Legal, which supports the legal rights of LGBT and HIV people, Scott Schoettes, the group’s HIV project director, said:

“This is great news. The majority ruled to preserve the tax credits and maintain the integrity of the Affordable Care Act, protecting access for all, including people living with HIV who are low-income, rural, southern, Black, and were—before the Affordable Care Act—largely uninsured. No one should be put at greater risk to the ravages of HIV simply because they live in one of the 34 states choosing not to set up its own health insurance exchange.”

Dan Bruner, the senior director of policy at Whitman-Walker Health, a nonprofit community center focused on the LGBT and HIV communities of Washington, DC, released the following statement on the ruling:

“We are gratified and thrilled that the Supreme Court has once again saved the Affordable Care Act from efforts to destroy it. The decision by the Chief Justice and a 6-3 majority cuts right to the heart of the issue: the federal subsidies that help middle- and lower-income individuals and families to afford health insurance must be available in every state for healthcare reform to work. This is wonderful news for the nation, particularly for people living with HIV, the LGBT community, and others who have suffered from lack of adequate, affordable health insurance for so long.”

And Phill Wilson, president and CEO of the Black AIDS Institute, said in a statement: “This is a victory for the American people. A decision to strip away the subsidies would have decimated the Affordable Care Act and denied access to health care to millions of Americans, leaving people to having to choose between healthcare and food, housing or their children’s education, and returning to the days when getting sick meant going bankrupt for many Americans.”