WASHINGTON — President Barack Obama announced Thursday that 8 million people have signed up for health insurance under the Affordable Care Act, calling the feat a success story that Democrats should “forcefully defend and be proud of” in the face of Republican election-year attacks on the law.

Speaking at an impromptu news conference, the president described how the law has helped make a difference for ordinary citizens such as a young woman in Pennsylvania with a self-employed husband and two small children who managed to get insurance despite being diagnosed with breast cancer.

“I think that Democrats should forcefully defend and be proud of the fact that millions of people like the woman I just described, who I saw in Pennsylvania yesterday, we’re helping because of something we did,” he said. “I don’t think we should apologize for it, and I don’t think we should be defensive about it. I think is a strong, good, right story to tell.”

The final figure is well above the White House’s initial target of 7 million sign-ups.

Armed with those enrollment numbers, Obama challenged the political dynamic that has grown up around the law and that has unnerved some members of his party. Problems with the law have become a central theme in the Republicans’ efforts to wrest control of the Senate this fall. Obama blasted Republicans for continuing to press for its repeal, saying they had repeatedly erred in their predictions.

“They said no one would sign up. They were wrong about that,” he said. “They are wrong to try to repeal a law that is working.”

The final figure of how many Americans will gain health coverage under the law remains unclear for several reasons. Some portion of those who have signed up on the state and federal health insurance exchanges won’t follow through and pay their premiums, so their insurance will not begin. And not everyone who is signing up for coverage is getting it for the first time, because some are shifting from previous health plans, which failed to meet the law’s essential benefits requirements.

On the other hand, the 8 million figure does not include everyone who is newly insured, because more than 1 million consumers — and possibly many more — have bought plans directly through insurance companies. And 3 million Americans have been determined newly eligible for Medicaid as a result of the program’s expansion in 26 states and the District of Columbia, according to administration figures.

The Congressional Budget Office projected that 7 million Americans would enroll in state and federal marketplaces during the initial six-month open enrollment period that began Oct. 1, although it scaled back its forecast to 6 million after the federal website, HealthCare.gov, failed to function properly for the first two months.

While open enrollment was supposed to end March 31, the administration allowed any consumer who tried to sign up for coverage before that date to return by April 15 and finish picking a plan. The figures the White House released Thursday reflect enrollment through then on the federal and state exchanges.

Senate Minority Leader Mitch McConnell, R-Ky., said in a statement Thursday that Obama had glossed over the fact that many Americans had been unable to keep their previous plans and may now be getting inferior coverage.

“Noticeably absent from the President’s remarks today was any mention of the millions of Americans who were deceived about what Obamacare would mean for them and their families,” McConnell said. “Countless Americans have unexpectedly been forced out of the plans they had and liked, are now shouldering dramatically higher premiums, and can no longer use the doctors and hospitals they choose. It’s long past time for Washington Democrats to work with us to remedy the mess they created — and that means repealing this law and replacing it with real reforms that actually lower costs.”

Obama also touted the fact that 35 percent of those who have signed up for the insurance plans are younger than 35 and that premiums are projected to be 15 percent lower than predicted.

But that figure includes children, and the key demographic that many policy experts had been focused on — those 18 to 34 — accounted for just 28 percent of enrollees, according to the White House. Health experts who support the law had hoped that young people would account for 40 percent of those in the overall risk pool, on the grounds that they were more likely to be healthy and, therefore, could keep premium increases in check.

The president said that Republicans had “gone through the stages of grief” but that he held out hope they would “make the transition” to improving the law. “Anger and denial and all that stuff, and we’re not at acceptance yet, but at some point my assumption is that there will be an interest to figure out how do we make this work in the best way possible,” he said.

There was little sign of that Thursday. Sen. John Thune of South Dakota, chairman of the Senate Republican Conference, said in a statement that the president’s “latest ObamaCare ‘victory’ lap is an insult to the millions of Americans” who lost their existing plans and face higher costs and fewer options for doctors. House Majority Whip Kevin McCarthy of California said Obama was “right” when he said the GOP refuses to accept the Affordable Care Act “as settled law.”

“Republicans cannot and will not accept this law,” McCarthy said in a statement.

It was unclear whether some of the Democratic incumbents facing the toughest reelection fights in conservative-leaning states — such as Mark Begich of Alaska, Kay Hagan of North Carolina, Mary Landrieu of Louisiana and Mark Pryor of Arkansas — will embrace Obama’s message.

By contrast, Sen. Barbara Boxer, D-Calif., a liberal, issued a statement Thursday hailing both her state’s performance and the administration’s.

“Open enrollment is over and the verdict is in: Obamacare is working for America’s families,” Boxer said. “The news from California is nothing short of fantastic — 1.4 million people have now enrolled, which is more than double the original projection.”

Washington Post staff writers Paul Kane and Amy Goldstein contributed to this report.