WASHINGTON — The Supreme Court on Thursday ruled for South Carolina in its effort to defund Planned Parenthood, concluding that individual Medicaid patients cannot sue to enforce their right to pick a medical provider.

The court held in a 6-3 ruling along ideological lines, with the conservative justices in the majority, that the federal law in question does not allow people who are enrolled in the Medicaid program to file such claims against the state.

The ruling written by Justice Neil Gorsuch is a boost to the state’s effort to prevent Planned Parenthood from receiving funding through Medicaid, a federal program for low-income people that is administered by the states, because it prevents individual patients from enforcing their right to choose their preferred health care provider. The ruling could also give a boost to other Republican-led states that choose to follow suit.

“Congress knows how to give a grantee clear and unambiguous notice that, if it accepts federal funds, it may face private suits asserting an individual right to choose a medical provider,” Gorsuch wrote.

But, he added, “that is not the law we have.”

Federal funding for abortion is already banned, but conservatives have long targeted funding for Planned Parenthood, which provides reproductive health services, including abortions where allowed, even when that money is for other health care-related services.

They argue that even non-abortion-related funding that flows to Planned Parenthood would help it carry out its broader agenda that favors abortion rights.

South Carolina Gov. Henry McMaster, a Republican, issued an executive order in 2018 that prohibited Planned Parenthood South Atlantic, the local affiliate of the national group, from providing family planning services under Medicaid.

“Seven years ago, we took a stand to protect the sanctity of life and defend South Carolina’s authority and values — and today, we are finally victorious,” McMaster said in a statement.

A total of 18 states backed South Carolina in the case.

“States should be free to fund real, comprehensive care and exclude organizations like Planned Parenthood that profit off abortion,” said John Bursch, a lawyer at the conservative Christian group Alliance Defending Freedom, who argued the case on behalf of South Carolina.

Planned Parenthood condemned the decision, with Paige Johnson, president of the local affiliate, saying in a statement it was a “grave injustice that strikes at the very bedrock of American freedom and promises to send South Carolina deeper into a health care crisis.”

Justice Ketanji Brown Jackson dissented along with her two liberal colleagues, writing in her opinion that the decision was part of a long line of rulings that has undermined the 1871 Civil Rights Act that was enacted after the Civil War to allow people to sue for civil rights violations.

“South Carolina asks us to hollow out that provision so that the state can evade liability for violating the rights of its Medicaid recipients to choose their own doctors,” she said. “The court abides South Carolina’s request. I would not.”

The state’s efforts to defund Planned Parenthood came before the Supreme Court, which has a 6-3 conservative majority, overturned the landmark Roe v. Wade abortion rights ruling in 2022.

South Carolina now has a six-week abortion ban, meaning abortions are rare in the state.

Planned Parenthood has facilities in Charleston and Columbia that provide abortion care in compliance with the new law, as well as other health care services, including contraception, cancer screenings and pregnancy testing.

Following McMaster’s executive order, Julie Edwards, a Medicaid-eligible patient who wants to use Planned Parenthood, joined a lawsuit filed by the group, saying that under federal civil rights law she could enforce her rights in court.

A federal judge ruled in her favor, and after lengthy litigation, the Supreme Court agreed to weigh in.