The Republican tax bill is massively unpopular. It polls at about 30 percent approval—the worst showing of any major bill in recent history—and doesn’t crack 50 percent even among Republicans. And yet, the GOP leadership is hellbent on passing it. What’s going on?

Bear with me for a bit. I have an idea of what’s going on, but it’s the endpoint of a story. Here it is.

Beginning in the mid-60s, the Republican and Democratic parties consciously chose opposing long-term strategies. Democrats became the party of the marginalized, defining themselves in terms of civil rights, immigration, social justice, feminism, gay rights, and so forth. Republicans chose to become the party of whites and the party of the Bible Belt.

At first, this was mostly a matter of policy choices. Republicans opposed things like school busing and affirmative action and supported private schools. As those things gradually lost salience, they reached out for other, more process-oriented ways of leveraging the white vote. In the 90s it was pack and crack, which shoved black voters into a small number of congressional districts, leaving more white districts for Republicans to pick up. Karl Rove moved the ball forward with more sophisticated ways of driving white evangelical turnout. Fox News amped up its coverage of things like illegal immigration and black crime.

Over time, the returns from these strategies became smaller and smaller. The white share of the population wasn’t growing, so Republicans became desperate to pick up every possible crumb. Photo ID laws became a big push in the late aughts even though it’s unlikely they affected the vote by more than a percent or so. The post-2010 gerrymandering efforts were good for a dozen seats in Congress. The party got tougher on immigration. Republicans on the Supreme Court gutted the Voting Rights Act. But finally there was little left to do. They lost to a black man in two straight elections, and the 2012 post-election autopsy made it clear that Republicans needed to attract more of the non-white vote. This was based on some simple but brutal arithmetic: There was a limit to how much turnout they could squeeze from the dwindling share of white voters, and that meant they had to reach out to minorities, pass comprehensive immigration reform, and dial down the anti-gay rhetoric.

Republicans aren’t idiots. They can read a demographic report as well as anyone. They know their white base is shrinking and they know they’ve reached a critical point. The problem is that remaking their party is a long-term project, and while it’s happening they’re going to lose elections. It will take years to regain the trust of communities of color, and efforts to do so will alienate the whites who support them today. They could be in the wilderness a long time while this project is ongoing.

And so it never got off the ground. It was just too hard. It looked more and more as if Republicans would shamble slowly into minority party status for a long time as they struggled to remake themselves.

But then a miracle happened. Donald Trump pushed the envelope further than even the hardest-core Republican had dared in decades, appealing all but openly to white voters and shamelessly demonizing minorities. The Republican establishment didn’t support him initially, but he gained the nomination anyway so they made their peace. And he won. And Republicans won the Senate. And they held onto the House. Against all odds, they controlled the entire federal government.

But again: Republicans aren’t idiots. They recognize just how unlikely this victory was and they know it won’t repeat itself. Demographic trends won’t slow down and midterm elections always go against the party in power anyway. They’re probably going to lose unified control of the government in 2018, and even if they hang on they won’t make it past 2020. This is their last chance to control the levers of power, quite possibly for a decade or two.

That’s why they’re pushing an unpopular tax bill. That’s why they’re focused like a laser on confirming judges. That’s why they might even take on entitlement reform. They’re going to lose power shortly no matter what they do, so they’re trying to put their stamp on the future while they still have the chance.