Michael D. Shear and Robert Pear / New York Times News Service

BOSTON — The White House on Wednesday blended expressions of contrition for the troubled rollout of its health care law with an aggressive rejection of Republican criticism of it, as the administration sought a political strategy to blunt the fallout from weeks of technical failures and negative coverage.

While Kathleen Sebelius, the secretary of health and human services, apologized profusely during a politically charged hearing on Capitol Hill, President Barack Obama traveled to Massachusetts to argue forcefully that the Affordable Care Act will eventually be just as successful as the similar plan pioneered by Mitt Romney, his onetime rival and a former governor of the state.

Speaking in the historic Faneuil Hall, where Romney signed the Massachusetts plan into law, the president also took “full responsibility” for the malfunctioning health care website and promised to fix it. But he pledged to “grind it out” over the weeks and months ahead to ensure the law’s success and prove its Republican critics wrong.

“We are going to see this through,” Obama vowed, pounding his fist on the lectern as the audience roared with approval.

The dual messages from Obama and Sebelius over the course of the day reflect a recognition by officials inside the White House that while apologies are in order, the administration cannot let Republicans expand concerns about the HealthCare.gov website into a broader indictment of the law.

Senior advisers to the president said they understood that the bungled rollout of the insurance marketplace has given Republicans another opportunity to litigate the political case against the health care law. But they said they viewed the weeks ahead as a period of inevitable improvement that will vindicate their position.

With Republicans showing no sign of backing off, the challenge for Obama and Democrats in the months ahead will be to deflect political attacks that unfairly demonize the health care law while acknowledging its shortcomings. Achieving that nuance could prove tricky for an administration whose top health official, Sebelius, on Wednesday called the rollout of the online insurance marketplace a “debacle.”

Sebelius told lawmakers on the House Energy and Commerce committee that she was as surprised as anyone when the website collapsed Oct. 1, under pressure from millions of users, and was crippled by technical problems in subsequent days. While she was aware of the risks in a big information technology project, she said, “no one indicated that this could possibly go this wrong.”

Sebelius told the committee: “Hold me accountable for the debacle. I’m responsible.”

The shift in strategy from the White House comes as new challenges emerge for the law. The problem-plagued website crashed again just before Sebelius began testifying in front of a skeptical congressional panel. And officials acknowledged that the federal insurance marketplace for small businesses, which had already been delayed a month from Oct. 1, will not open until the end of November.

In 31⁄2 grueling hours of testimony, Sebelius gamely defended the problem-plagued rollout of the law and apologized for what had gone wrong. But nothing she said could overcome the stark message displayed on a large video screen showing a page from HealthCare.gov: “The system is down at the moment. We are experiencing technical difficulties and hope to have them resolved soon. Please try again later.”

Rep. Mike Rogers, R-Mich., said the administration had not properly tested the security of the insurance website, which receives financial information on consumers seeking subsidies to help pay their premiums.

Rogers read from a government memo that said security controls for the federal exchange had not been fully tested as of Sept. 27. This creates a potentially “high risk” for the exchange, said the memo, from the Centers for Medicare and Medicaid Services. The memo said that security controls would be “completely tested within the next six months.”

Republicans continued to accuse Obama of lying to the American people when he said repeatedly over the past four years that anyone who had a health insurance plan they liked could keep it, regardless of the changes brought on by the Affordable Care Act. Lawmakers grilled Sebelius on why insurance companies are canceling policies for thousands of people.

Rep. Fred Upton, R-Mich., chairman of the committee, said “there are millions of Americans coast to coast who no doubt believed the president’s repeated promise that if they liked their plan, they’d be able to keep it. They are now receiving termination notices.”

Sebelius tried, with little success, to allay concerns about those notices. She said the cancellation of some policies was a justifiable byproduct of the 2010 health law.