A federal judge declared a key component of President Barack Obama’s health care law unconstitutional, throwing the future of the president’s signature achievement into uncertainty by ruling that the government cannot require Americans to buy insurance.

The decision on Monday is a strike against Mr. Obama’s top domestic priority designed to spread coverage to millions of Americans who lack it, and the case is expected to end up in the Supreme Court.

In his order, U.S. District Judge Henry E. Hudson said he will allow the law to remain in effect while appeals are heard, meaning there is unlikely to be any immediate impact on other provisions that have already taken effect. These include free preventive care, an elimination of lifetime limits on coverage and a requirement for insurers to allow adult children to stay on their parents’ health plans until age 26.

The part of the law that mandates insurance coverage is not scheduled to begin until 2014.

Hudson, a Republican-appointee, sided with Virginia Attorney General Kenneth Cuccinelli, who argued the mandate overstepped the bounds of the U.S. Constitution.

“The ruling is extremely positive for anyone who believes in the system of Federalism created by our founding fathers,” Mr. Cuccinelli said.

In the short term, the court’s decision hands ammunition to Republican opponents as they prepare to assert control in the new Congress in January with promises to repeal the law. Obama has promised to veto any repeal legislation and appears likely to be able to prevail since Democrats retain control of the Senate. Republicans also have discussed trying to starve the law of the funding needed to implement it.

The White House predicted it would prevail in the Supreme Court, although it may be a year or two before the health care law gets there. The next step for the lawsuit is the 4th U.S. Circuit Court of Appeals in Richmond, where Democratic-appointed judges hold a majority.

Republicans in Congress celebrated the ruling as validation of the arguments they had made for months while the law was being debated in Congress. Rep. Eric Cantor, the No. 2 House Republican leader, issued a statement urging the White House to agree to expedite a final ruling by appealing directly to the Supreme Court without first stopping at the appeals court.

Hudson is the first federal judge to strike down a key part of the law, which had been upheld by fellow federal judges in Virginia and Michigan. Several other lawsuits have been dismissed and still others are pending, including one filed in Florida by 20 states.

In an interview with television station WFLA in Tampa, Fla., on Monday, Mr. Obama emphasized that other judges had either found the law constitutional or dismissed lawsuits against it.

“Keep in mind this is one ruling by one federal district court. We’ve already had two federal district courts that have ruled that this is definitely constitutional,” Mr. Obama said. “You’ve got one judge who disagreed. That’s the nature of these things.”

White House health reform director Nancy-Ann DeParle said the Justice Department is reviewing Hudson’s ruling.

The government had argued the Commerce Clause of the U.S. Constitution gives it the power to require people to buy health insurance or face a penalty.

Hudson acknowledged his court will not be the last stop.

“The outcome of this case has significant public policy implications. And the final word will undoubtedly reside with a higher court,” he wrote.

The Department of Justice stood by its argument that Congress was within its rights to enact the law.

“We are disappointed in today’s ruling but continue to believe -- as other federal courts in Virginia and Michigan have found -- that the Affordable Care Act is constitutional,” spokeswoman Tracy Schmaler said.

While the judge left other portions of the law intact, administration officials and outside analysts agree that important provisions of the legislation could not go forward without the requirement for everyone to be insured. That’s because insurers need to have large pools of healthy people, who are cheap to insure, or it is not financially tenable for them to extend coverage to anyone with a pre-existing condition or guarantee certain policies to nearly all comers, as the law requires.

The lawsuit was filed by Cuccinelli, a Republican, in defense of a new state law passed in reaction to the federal overhaul that prohibits the government from forcing state residents to buy health insurance.

Cuccinelli argued that while the government can regulate economic activity that substantially affects interstate commerce, the decision not to buy insurance amounts to economic inactivity that is beyond the government’s reach.

Hudson, a Republican appointed by President George W. Bush, sounded sympathetic to the state’s case when he heard oral arguments in October, and the White House expected to lose this round.