WASHINGTON — Turning their budget knife to domestic programs to protect the Pentagon, House Republicans Thursday approved legislation cutting food stamps, benefits for federal workers and social services programs such as day care for children and Meals on Wheels for the elderly.

President Barack Obama’s Wall Street reform law would be rewritten under the legislation, passed on a 218-199 vote, while his controversial overhaul of the U.S. health care system also would be cut.

The legislation would deny illegal immigrants child tax credits they can currently claim, while new curbs on medical malpractice lawsuits are credited with driving down Medicare and Medicaid costs.

The bill, passed after a passionate, sometimes hyperbolic debate, would spare the military from a $55 billion, 10 percent automatic budget cut next year that the result of the failure of last year’s deficit-reduction “supercommittee” to strike a deal.

It also would protect domestic agencies from an 8 percent cut to their day-to-day operating budgets next year, but would leave in place a 2 percent cut to Medicare providers.

The legislation is a dead letter in the Senate, however, where Democratic leaders insist on keeping the automatic cuts in place as leverage to try to force Republicans to agree to a mixture of tax increases and spending cuts to address the nation’s deficit.

Defense hawks have warned that the automatic cuts would mean a 200,000-troop cut, military base closings and a significantly smaller Navy and Air Force.

The Pentagon brass has warned repeatedly that the automatic cuts would have a debilitating effect on readiness.

“It’s not shooting ourselves in our foot,” said Armed Services Committee Chairman Buck McKeon, R-Calif. “It’s shooting ourselves in the head.”

There’s common agreement that the automatic cuts need to be reversed, but Democrats and Republicans remain at odds over the best way to do that.

“Today we are having a debate over whether to eliminate wasteful, duplicative spending and unnecessary, flawed federal programs,” or to let automatic cuts “disarm our military, disrupt their operational capabilities and shrink America’s fighting force,” said Rep. Tom Price, R-Ga.

“Do we really want to have the men and women of our military pay the price for Washington’s fiscal irresponsibility?”

Democrats countered that the GOP plan, which swaps more than $300 billion in cuts over the coming decade to preserve $78 billion in spending next year, unfairly targets the poor while preserving tax breaks enjoyed by the wealthy and corporations.