The House of Representatives has become The Lord of the Flies. Republicans, despite being in the majority, lost a vote on major legislation (the Farm Bill) put forward by its leaders. The leadership might also lose control of the floor agenda, through an unusual maneuver that would force a series of uncomfortable votes on immigration. The speaker of the House could get booted in a nearly unprecedented insurrection right before the midterm elections. Moderates on the left and hardliners on the right are in open revolt.

This is not how Paul Ryan wanted to leave office. But his decision to retire at year’s end, prompted by a desire to protect himself from a tough election, caused this debacle—and it’s imperiling the political project he spent a career building.

Ryan, who was elected in 1998 and became speaker in 2015, has long advocated for cutting programs for the poor, an agenda he cloaks in the language of “reform” and justifies with performative concern over the budget deficit. The more credulous members of the media too often bought that act. But his was always just a reverse–Robin Hood redistribution project, an Ayn Randian anti-government paradise where the welfare state was quietly strangled for the benefit of the wealthy.

Ryan waited his entire career for a right-wing president willing to enact this agenda. He got one in Donald Trump. But then he discovered the ugly truth—the public hated his ideas and would recoil if he ever tried to put them into effect. When Ryan went after Obamacare, his own party struggled to pull the trigger on culling millions of Americans from the insurance rolls; eventually they abandoned the repeal effort. On taxes, he claimed to champion reform but ended up just giving corporations a big cut, while not making the code even a little bit simpler. And Ryan didn’t prepare for the propulsive power of identity-based issues like immigration to rip his caucus asunder.

When Trump issued his withdrawal of the Deferred Action for Childhood Arrivals program last September, Ryan put Republican members from across the ideological spectrum on immigration in a room together and asked them to come up with a solution that could win broad support. But it was obvious from the beginning that there was no compromise to be made; Ryan just didn’t want to take any leadership and be held responsible for the fallout. The effort fizzled.