WASHINGTON — The Republican-led House has narrowly passed a sweeping farm bill that would toughen work requirements for food stamp recipients.

The bill passed by a vote of 213-211. Democrats unanimously opposed the measure, saying it would toss too many people off government food assistance. But 20 Republicans also voted no, giving GOP leaders a brief scare in what was their second attempt to pass a farm bill. In May, they suffered an embarrassing setback when 30 GOP members opposed passage in an effort to get a vote on immigration legislation.

The measure renews the safety net for farmers as President Donald Trump’s tough talk on tariffs threatens to close markets for many of their products.

The bill requires able-bodied adults aged 18-59 to work or participate in job training for 20 hours a week in order to receive food stamp benefits.

The House bill sets up a certain clash with the Senate, which is looking to make mostly modest adjustments to existing agriculture programs in its bill without picking a fight over food stamps.

Rep. Mike Conaway, the Republican chairman of the House Agriculture Committee, said he believed there were concerns among some GOP lawmakers about the amount of spending in the bill as well as changes to the Supplemental Nutrition Assistance Program, or SNAP.

“I knew it was going to be razor-thin,” Conaway said of the vote.

The bill requires able-bodied adults aged 18-59 to work or participate in job training for 20 hours a week in order to receive food stamp benefits that average about $450 a month for a family of four. Government auditors estimate that in 10 years, the SNAP caseload would shrink by about 1.2 million people in an average month if the bill becomes law.

READ MORE: Hunger a persistent problem for poor Americans as Republicans mull SNAP cuts

House Speaker Paul Ryan, R-Wis., said the changes will “close the skills gap, better equip our workforce, and encourage people to move from welfare to work, so more Americans have the opportunity to tap into the economic prosperity we’re seeing right now.”

The legislation has traditionally been bipartisan, blending support from urban Democrats supporting nutrition programs with farm-state lawmakers supporting crop insurance, farm credit, and land conservation. The Senate earlier this month unveiled a budget-neutral and bipartisan bill. A Senate committee approved the legislation last week, 20-1.

“It still leaves farmers and ranchers vulnerable, it worsens hunger and it fails rural communities” – Rep. Collin Peterson

Although the House bill broke from that bipartisan convention, its position on work requirements for SNAP recipients is consistent with the Trump administration’s priorities. Earlier this year, President Donald Trump signed an executive order directing federal agencies to enforce existing work requirements and review all programs, waivers and exemptions.

The measure also limits circumstances under which families who qualify for other poverty programs can automatically be eligible for SNAP, and earmarks $1 billion to expand work training programs.

Democrats have expressed outrage over the bill, with Democratic leader Nancy Pelosi calling it “cruel and destructive.”

Rep. Collin Peterson of Minnesota, the ranking Democratic lawmaker on the House Agriculture Committee, said the bill “simply doesn’t do enough for the people it’s supposed to serve.”

“It still leaves farmers and ranchers vulnerable, it worsens hunger and it fails rural communities,” Peterson said.