WASHINGTON (AP) — The Supreme Court has upheld the differential treatment of residents of Puerto Rico, ruling that Congress was within its power to exclude them from a benefits program that’s available in all 50 states and the District of Columbia.

The court held by an 8-1 vote Thursday that making Puerto Ricans ineligible for the Supplemental Security Income program, which provides benefits to older, disabled and blind Americans, did not unconstitutionally discriminate against them.

Justice Sonia Sotomayor, whose parents were born in Puerto Rico, was the lone dissenter.

Writing for the court, Justice Brett Kavanaugh said the court was bound by a pair of earlier rulings that already upheld the federal law that created SSI and excluded Puerto Rico and other U.S. territories from it. Congress later added in the Mariana Islands.

Puerto Rico has been a U.S. territory since the Spanish American War in 1898, and its residents are U.S. citizens. They can vote in primaries, but not the presidential election, and have limited representation in Congress. Many also do not pay federal income tax.

Kavanaugh wrote that “just as not every federal tax extends to residents of Puerto Rico, so too not every federal benefits program extends to residents of Puerto Rico.”

In dissent, Sotomayor responded, “In my view, there is no rational basis for Congress to treat needy citizens living anywhere in the United States so differently from others. To hold otherwise, as the Court does, is irrational and antithetical to the very nature of the SSI program and the equal protection of citizens guaranteed by the Constitution. I respectfully dissent.”

The decision outraged many in Puerto Rico including Gov. Pedro Pierluisi, who said statehood is the only solution to Puerto Rico’s second-class status.

“The decision … once again confirms that the territorial status of Puerto Rico is discriminatory for the island’s U.S. citizens and allows Congress to do what it wants with us,” he said in a statement.

Pierluisi noted that Puerto Rico also receives unequal treatment when it comes to Medicaid, Medicare and other federal programs.

Meanwhile, Jenniffer González, Puerto Rico’s representative in Congress and a member of Pierluisi’s pro-statehood party, called the exclusion an “unbelievable discrimination” that keeps more than 300,000 people in extreme poverty.

Jose Luis Vaello-Madero, the Puerto Rico resident at the center of the case, began receiving SSI payments after he suffered a series of strokes while living in New York.

The payments continued to his bank account in New York even after he moved back to Puerto Rico. When he notified the Social Security Administration, the payments stopped and then the government sued to recover more than $28,000 it said he was not entitled to.

Lower courts sided with Vaello-Madero, ruling that the exclusion of Puerto Rico from the SSI program is unconstitutional. In a similar case in Guam, a federal judge ruled recently that residents of that Pacific island also should be able to collect SSI.

The Justice Department first filed its appeal of a ruling by the 1st U.S. Circuit Court of Appeals during the Trump administration but maintained the case even after President Joe Biden took office.

The Biden administration has said it supports changing the law to extend SSI payments to Puerto Rico. It included a provision in its Build Back Better proposal to make residents of U.S. territories eligible for SSI payments, but the legislation is stalled in Congress.

A separate program, Aid to the Aged, Blind and Disabled, covers residents of the territories, but it has more stringent eligibility requirements and pays less generous benefits than SSI.