A federal judge declared the Affordable Care Act unconstitutional Friday, ruling that the entire law must be struck down because Congress invalidated the tax penalty for not buying health insurance — the basis for the Supreme Court's 2012 ruling that declared the law constitutional.

Why it matters: The long-awaited ruling by the Texas judge isn't the last word on the issue. A spokeswoman for California Attorney General Xavier Becerra says the state is already planning an appeal, per Bloomberg. But it leaves the entire future of Barack Obama's health care law uncertain — and is sure to put President Trump and congressional Republicans on the defensive, as it would mean the end of protections for people with pre-existing conditions.

"The Court finds the Individual Mandate ‘is essential to’ and inseverable from ‘the other provisions of’ the ACA."

— U.S. District Judge Reed O'Connor

"As I predicted all along, Obamacare has been struck down as an UNCONSTITUTIONAL disaster! Now Congress must pass a STRONG law that provides GREAT healthcare and protects pre-existing conditions. Mitch and Nancy, get it done!"

— President Trump on Twitter Friday night

"When House Democrats take the gavel, the House of Representatives will move swiftly to formally intervene in the appeals process to uphold the life-saving protections for people with pre-existing conditions and reject Republicans’ effort to destroy the Affordable Care Act.”

— Speaker-designate Nancy Pelosi

The backstory:

The ruling was issued in a lawsuit by a coalition of Republican-led states led by Texas.

O'Connor had already signaled in a September hearing that he was open to the red states' arguments.

The ruling comes one day before the last day of open enrollment for ACA coverage for 2019.

In an interview with "Axios on HBO," President Trump said he'd reinstate protections for pre-existing conditions if the lawsuit gutted the ACA. But as Axios' Sam Baker notes, Republicans have never come up with a replacement plan that would offer the same level of protection as the ACA.

Timothy Jost, a legal expert and supporter of the ACA, told Axios' Caitlin Owens that the ruling shouldn't have any effect until Jan. 1, since the tax penalty is still in effect until then. Beyond that, he says, it depends on how the Trump administration reacts and whether a higher court stays the ruling.

Read the ruling:

Go deeper:

There's a new lawsuit over the ACA's individual mandate

Texas lawsuit throws the ACA's future into uncertainty

Exclusive poll: Public fears lawsuit over pre-existing conditions

This story has been updated with more details and reactions from President Trump and Nancy Pelosi.