The Supreme Court on Thursday dismissed a challenge to kill the Affordable Care Act (ACA) and saved health care coverage for millions.

The ACA will remain in place after the Supreme Court dismissed a challenge by Republican attorneys general in 18 states and the Trump administration to strike down the entire law. It was the third major challenge to the law and the third time the Supreme Court rejected efforts to kill parts or the entire law.

The Supreme Court voted 7-2 to dismiss California v. Texas, stating that Texas, as well as the other GOP-led states and two individuals, did not have the right to bring the lawsuit because the plaintiffs had not suffered any harm. “Neither the individual nor the state plaintiffs have shown that the injury they will suffer or have suffered is “fairly traceable” to the “allegedly unlawful conduct” of which they complain,” wrote Justice Stephen Breyer in the majority opinion. Justices Samuel Alito and Neil Gorsuch dissented.

The plaintiffs “have failed to show that they have standing to attack as unconstitutional the Act’s minimum essential coverage provision. Therefore, we reverse the Fifth Circuit’s judgment in respect to standing, vacate the judgment, and remand the case with instructions to dismiss,” Breyer wrote.

RELATED: Red states’ case against ACA hinges on whether they were actually harmed by the law

The crux of the challenge was that the Republican states claimed the ACA was unconstitutional once Congress passed Trump’s tax overhaul in 2017 that eliminated the individual mandate that required individuals to obtain health insurance or pay a penalty. Without the individual mandate, they argued that the entire law cannot stand. A group of 18 Democratic attorneys general and the House of Representatives defended the ACA.

The law not only provides health coverage for 31 million Americans, it also contains protections for people with preexisting conditions, the introduction of value-based bonus payments for the Stars program for Medicare Advantage plans, the expansion of Medicaid eligibility, and preventive health benefits for all Medicare beneficiaries.

In the dissenting opinion, Justice Alito wrote, “No one can fail to be impressed by the lengths to which this Court has been willing to go to defend the ACA against all threats. A penalty is a tax. The United States is a State. And 18 States who bear costly burdens under the ACA cannot even get a foot in the door to raise a constitutional challenge. So a tax that does not tax is allowed to stand and support one of the biggest Government programs in our Nation’s history. Fans of judicial inventiveness will applaud once again. But I must respectfully dissent.”

HHS Secretary Xavier Becerra, who led the defense of the ACA in the Supreme Court while the attorney general of California, released a statement on Thursday, applauding the Supreme Court ruling, which he called a victory for all Americans. “Health care should be a right—not a privilege just for the healthy and wealthy," he said. “Today’s decision means that all Americans continue to have a right to access affordable care, free of discrimination. More than 133 million people with pre-existing conditions, like cancer, asthma or diabetes, can have peace of mind knowing that the health protections they rely on are safe.”