WASHINGTON — A federal judge in Texas struck down the entire Affordable Care Act on Friday on the grounds that its mandate requiring people to buy health insurance is unconstitutional and the rest of the law cannot stand without it.

The ruling was over a lawsuit filed this year by a group of Republican governors and state attorneys general. A group of intervening states led by Democrats promised to appeal the decision, which will most likely not have any immediate effect. But it will almost certainly make its way to the Supreme Court, threatening the survival of the landmark health law and, with it, health coverage for millions of Americans, protections for people with pre-existing conditions and much more.

In his ruling, Judge Reed O’Connor of the Federal District Court in Fort Worth said that the individual mandate requiring people to have health insurance “can no longer be sustained as an exercise of Congress’s tax power.”

Accordingly, Judge O’Connor, a George W. Bush appointee, said that “the individual mandate is unconstitutional” and the remaining provisions of the Affordable Care Act are invalid.