Ending the Democrats’ decades-long quest to create a healthcare safety net to match Social Security, the House of Representatives on Sunday night approved sweeping legislation to guarantee Americans access to medical care for the first time, delivering President Obama the biggest victory of his young presidency.

The bill, which passed 219 to 212 without a single Republican vote, would make a nearly $1-trillion commitment in taxpayer money over the next decade to help an estimated 32 million uninsured Americans get health coverage.

And it would establish a broad new framework of government regulation to prevent insurance companies from denying coverage and, advocates hope, to begin making healthcare more affordable to most Americans.

“Tonight, at a time when the pundits said it was no longer possible, we rose above the weight of our politics,” the president said in a televised address from the East Room of the White House after the House completed its last vote. “We proved we are still a people capable of doing big things and tackling our biggest challenges.”

On the House floor, Democrats erupted into cheers of “Yes, we can!” at 10:45 p.m. Eastern time as the decisive 216th “yes” vote was recorded, capping a tortuous campaign that several senior lawmakers linked to the historic battle for civil rights two generations earlier.

“This is the Civil Rights Act of the 21st century,” said Democratic Rep. James E. Clyburn of South Carolina, the top-ranking black member of the House.

Obama will sign the bill within the next few days, while the Senate plans this week to begin debating a package of changes to the healthcare legislation that the House also passed Sunday, 220 to 211.

Angry protesters swarmed over the Capitol lawn throughout the day, cheering sympathetic Republicans who urged them on from the House balcony. They called for lawmakers to “kill the bill” and warned of dire political consequences for Democrats who voted for the legislation. “We will remember in November,” the crowd chanted.

Thirty-four Democrats, most from Republican-leaning districts, voted against the main legislation approving the blueprint for healthcare.

Rep. Pete Sessions (R- Texas), chairman of the National Republican Congressional Committee, promised that GOP candidates would turn the 2010 midterm elections into a referendum on healthcare. “We will run on a promise of repeal,” he said.

Many Republicans say the overhaul will drive the nation deeper into debt at a time when it is still struggling to recover from recession.

But after a final flurry of negotiating defused an intraparty dispute over abortion and locked down the last votes, Democratic lawmakers, some of whom have spent decades in Congress pushing for universal health coverage, were celebrating the payoff of a monumental gamble.

Obama and his congressional allies succeeded in pushing through the most sweeping piece of social legislation since the 1965 Medicare bill, despite a crippling recession and an increasingly angry electorate.

Now, Democrats must steer a package of fixes to the healthcare bill through the Senate by using the arcane budget reconciliation process.

The maneuver allows Senate Democrats to skirt a GOP filibuster and pass the package with only 51 votes rather than 60. But if Republicans succeed in making any changes to the package on the Senate floor -- as Democratic officials acknowledge is possible -- the House would have to take another healthcare vote.

But Sunday, after more than a year of procedural delays, partisan battling and a nail-biting search for votes, congressional Democrats seemed more focused on history than the remaining parliamentary obstacles.

Meeting at midday across the street from the Capitol, they received a final pep talk from Rep. John Lewis (D-Ga.), a veteran of the civil rights movement who, the day before, had been the target of racial epithets from a crowd of protesters.

Lewis reminded the assembled lawmakers Sunday that they were voting on the 45th anniversary of one of the famous civil rights marches between Selma, Ala., and Montgomery, Ala. Lewis had been beaten by police during the first of those marches.

After the caucus meeting ended, Lewis linked arms with House Speaker Nancy Pelosi of San Francisco and other senior Democrats for a walk with the assembled lawmakers to the Capitol through a gauntlet of protesters shouting, “Drop dead Pelosi” and “Save the Constitution.”

By late afternoon, Democrats cleared the final obstacle as the White House struck a deal with a group of antiabortion Democrats led by Rep. Bart Stupak of Michigan who had withheld their support over concerns that the legislation did not sufficiently ensure that federal funding would not be used for abortion.

The president agreed to issue an executive order directing his administration to develop guidelines to prohibit the use of taxpayer subsidies to pay for abortion services.

The executive order drew immediate fire from several antiabortion groups that called it inadequate. “Executive orders can be undone or modified as quickly as they are created,” said Charmaine Yoest, president of Americans United for Life.

But Stupak, flanked by other socially conservative Democrats, said he was satisfied Sunday with the protections.

Party leaders designed their healthcare overhaul to preserve the employer-based healthcare system in which most Americans get their insurance.

But the legislation would dramatically expand federal regulation of healthcare. Federal law would for the first time require insurance companies to cover all Americans, regardless of their health status, and would prohibit insurers from denying coverage to people who become sick.

Individuals would also be required to buy insurance. And large employers would have to provide employees with health benefits or in some cases face penalties.

The bill would open the nation’s 45-year-old Medicaid insurance program for the poor to all Americans earning less than 133% of the federal poverty line -- $14,404 for an individual or $29,327 for a family of four.

The government would also create new state-based insurance marketplaces for millions who do not get coverage through work.

Commercial insurers would offer plans in these marketplaces, or exchanges, and be required to provide a minimum set of benefits, including mental health services, maternity care and preventive care.

The most expensive feature is a commitment by the federal government to provide nearly $500 billion in subsidies over the next decade to help millions of low- and moderate-income Americans buy insurance in an exchange.

To pay for their legislation, Democrats approved a new 3.8% tax on investment income for individuals earning more than $200,000 and couples earning more than $250,000. In 2018, people with high-end “Cadillac” health plans would be subject to a new tax on their benefits.

And medical device makers, pharmaceutical companies and insures would be subject to new excise taxes.

The bill would also cut more than $400 billion over the next decade in what Medicare pays to hospitals, nursing homes and insurance companies that provide Medicare Advantage plans, a provision that proponents hope would ultimately help make the system more efficient.

noam.levey@latimes.com

janet.hook@latimes.com