Nearly everything about the House Republicans’ farm bill was a mess.

At GOP leaders’ insistence, for example, it would’ve increased food insecurity for millions of struggling Americans by cutting the Supplemental Nutrition Assistance Program. What’s more, the traditionally bipartisan bill was, this year, put together exclusively by Republicans. Donald Trump’s demand for punitive work requirements was, of course, also included in the package.

Making matters slightly worse, as the Washington Post’s Catherine Rampell explained, the GOP bill would also create a new layer of government bureaucracy, which “eats up nearly all the ‘savings’ from kicking people off food stamps,” intended to make it more difficult for qualifying Americans to receive benefits.

And in case all of this weren’t quite messy enough, when the House Republican leadership brought the bill to the floor this morning, it failed. Roll Call reported:

In a major blow to Republican leaders and after a week full of drama and last-minute vote wrangling, the House failed to pass a farm bill Friday, with several Freedom Caucus members voting no in protest to a lack of immediate action on immigration. The bill failed 198-213. House GOP leaders had been touting the bill as a fulfillment of their campaign promise to overhaul welfare programs. The vote also brings the GOP’s intraparty fissures further into public view.

This was a fight with several moving parts, and much of the debate was tied to an unrelated debate over immigration: the right-wing Freedom Caucus’ members said they would withhold support for the farm bill unless GOP leaders agreed to first hold a vote on a far-right immigration plan.

Republican leaders thought they’d made progress on reaching some kind of deal with the Freedom Caucus – it’s why they brought the bill to the floor, rather than punting – but in the end, it wasn’t enough.

Complicating matters is that many in the GOP thought the proposal just wasn’t far enough to the right. It was a striking reminder of just how difficult governing can be in this Congress.

If House GOP leaders capitulate to their extremist flank, they end up with bad bills that can’t pass the Senate. If House leaders ignore the Freedom Caucus’ demands, its members block the leadership’s bills.

House Speaker Paul Ryan (R-Wis.) and his lieutenants could do what John Boehner occasionally did – go to Democrats, hat in hand – but (a) they don’t want to, (b) that may not work; and (c) such a move would only exacerbate intra-party tensions.

What’s less clear is what happens now. The House will have to try again to pass a farm bill, and today’s package can be brought back anytime, but if there’s a map for the road ahead, it’s hiding well.

Postscript: Donald Trump yesterday seemed excited about today’s House vote. I guess he didn’t realize what was about to happen.