An oddfellows coalition of Democrats and the conservative House Freedom Caucus on Friday sunk a bill to reauthorize farm and nutritional programs for another five years, delivering a humiliating defeat for Republican leaders in the lower chamber of Congress.

Democrats voted en masse against the bill, mainly over objections to proposed changes that would required able-bodied adults to work or participate in job-training programs in order to receive food stamps.

“No” votes also came from 30 Republicans, some of them for a completely different reason — a revolt against the refusal of Speaker Paul Ryan (R-Wis.) to bring up an immigration bill, sponsored by House Judiciary Committee Chairman Bob Goodlatte (R-Va.), that contains multiple reforms President Donald Trump has sought.

Rep. Mark Meadows (R-N.C.), chairman of the Freedom Caucus, signaled his opposition Friday before the vote.

“Not enough progress made toward a solution on the immigration issue,” tweeted his spokesman, Ben Williamson. “We look forward to hopefully continuing discussions in the coming days.”

But the Freedom Caucus was not unified. Reps. Mo Brooks (R-Ala.), Scott DesJarlais (R-Tenn.) and Ted Yoho (R-Fla.) voted for the bill, for instance. And the 213-198 tally included “nays” from some moderate Republicans, including Reps. Leonard Lance, Frank LoBiondo and Rodney Frelinghuysen of New Jersey,

The $868 billion farm bill included a host of subsidies for farmers and the Supplemental Nutrition Assistance Program (SNAP) — the formal name for food stamps — which provides grocery vouchers to more than 40 million Americans.

The work requirement would not have applied to the elderly, disabled or parents of children younger than six. It also would have reduced the ability of states to waive the work requirement.

For unemployed food stamp recipients of working age, the bill would have included an additional $7 billion for job training and to hire case managers to help beneficiaries get training, other types of assistance and — ultimately — jobs.

Democrats formed a unified bloc.

Who do you think would win the Presidency?

By completing the poll, you agree to receive emails from LifeZette, occasional offers from our partners and that you've read and agree to our privacy policy and legal statement.

“Suffice it to say, I didn’t think I’d ever oppose a farm bill,” Rep. Sean Patrick Mahoney (D-N.Y.) said during the debate Friday. “I was proud to be part of a bipartisan team that wrote the last one.”

Mahoney said Democrats and Republicans traditionally have worked together on farm bills.

“But this farm bill is very different. And I’m disappointed to say, we’re following the best farm bill ever for the Hudson Valley with the very worst farm bill ever for the Hudson Valley,” he said. “It claims to create efficiencies, but really just ends up going after people who need a hand, the ones we are supposed to focus on in this bill.”

House Agriculture Committee Chairman Mike Conaway (R-Texas) urged members to vote “yes” after a process the included consideration of 51 amendments. He referred to the House electronic voting system — green for “aye” and red for “nay” votes.

“Green votes will mean you stand with Americans. You stand with those producers out there who are in terrible circumstances — 50 percent drop in farm income the last five years.”

“Green votes will mean you stand with Americans,” he said. “You stand with those producers out there who are in terrible circumstances — 50 percent drop in farm income the last five years.”

Voting against the bill also harms the prospects of struggling Americans who need help finding work, Conaway said.

“You’re saying ‘no’ to those guys as well,” he said.

The last-minute immigration wrinkle comes as momentum is growing for a “discharge petition” that would force a vote — over leadership objections — on amnesty for young illegal immigrants whose parents brought them to America as children.

Freedom Caucus members prefer Goodlatte’s bill, Securing America’s Future Act, which would grant a limited amnesty — but no path to citizenship — to a smaller group of illegal immigrants in exchange for a broad range of border security measures and changes to the legal immigration system.

Kristina Rasmussen, vice president of the Foundation for Government Accountability (FGA), expressed frustration that the immigration issue blocked passage.

“It’s really disappointing. The House of Representatives missed an amazing opportunity to reform the welfare system,” she told LifeZette.

Related: GOP Helps Dems Kill Conservative Amendments to Farm Bill

Ryan used a procedural device to preserve the ability to bring the legislation back to the floor at some point for a re-vote. Rasmussen said Ryan could schedule a vote on Goodlatte’s bill, but she added that the House calendar already is crowded.

The danger is that House Republicans will throw in the towel on reform and simply pass a bipartisan bill that maintains the status quo, Rasmussen said.

Goodlatte himself voted for the bill Friday. The House on Thursday voted down a number of amendments to make the bill more conservative. But Rasmussen said it would have significantly improved public policy and argued that immigration is wholly unrelated.

“It came out of nowhere,” she said. “You would think if it was a real issue, it would have come up before this.”

PoliZette senior writer Brendan Kirby can be reached at [email protected]. Follow him on Twitter.