Despite a president in the White House and majorities in Congress, Republicans can’t find the votes to pass a spending bill that would keep the government open past Friday at midnight.

The proximate issue is that Democrats won’t sign on to any bill that doesn’t permanently resolve the status of young unauthorized immigrants and address other priorities like funds for children’s health insurance and disaster relief. And without those Democratic votes, Senate Republicans can’t break the 60-vote threshold to overcome a filibuster.

Because Democrats represent the main obstacle, Republican leaders have pre-emptively blamed them for the looming government shutdown. “If Senate Democrats obstruct this legislation—and as a result shut down the government—they have made the decision to cut off pay to our troops and block children’s health care funding they support,” said House Majority Leader Kevin McCarthy, after House Republicans passed a stopgap bill on Thursday night that would keep the government open for a month while funding the Children’s Health Insurance Program for six years.

Rhetoric aside, however, the Republican Party is in an emergency of its own making. If, once again, Americans face a government shutdown, it’s because Republicans refuse to act as a governing party, wasting time on political gambits instead of doing the difficult work of finding consensus. [Update: It’s official. The failure to pass the continuing resolution led to a shutdown at midnight.]

It’s true that Democrats insist on a permanent solution for young unauthorized immigrants as part of any spending bill. The reason is straightforward: If a bill passes without action on these “Dreamers,” Democrats will lose the leverage to craft one on their terms. But this crisis is only occurring because President Trump decided to end Deferred Action for Childhood Arrivals, which granted protection from deportation to hundreds of thousands of young immigrants.

While Trump insists he wants to find a solution to this problem, his own statements are at odds with his behavior. Last week, the president scuttled the deal brokered by Sens. Lindsey Graham and Dick Durbin, following a now-infamous meeting where Trump called both Haiti and various African nations “shitholes.” Since then, the White House has been silent on what it wants from a deal, although Trump’s priorities aren’t hard to discern—he wants more white immigrants and fewer immigrants from countries whose citizens are largely black and brown. By putting the brakes on a viable compromise, Trump made this standoff inevitable.

The same is true of the Children’s Health Insurance Program. Since its funding lapsed late last year, congressional Republicans have refused to reauthorize CHIP, ignoring the problem in favor of passing tax cuts and tending to other priorities. Republican leaders like Paul Ryan might blast Senate Democrats for their current obstinance on this short-term funding bill, but their refusal to act last year belies their newfound concern for the program. The brinksmanship we see now has less to do with Democratic intransigence and more to do with a choice, by both Ryan and Senate Majority Leader Mitch McConnell, to use CHIP in a late-game legislative play. (The House eventually passed a bill with CHIP funding attached, but it was almost scuttled when President Trump tweeted his desire for a stopgap bill that didn’t include the program.)

That the House could move on a short-term bill was itself a minor miracle. On Tuesday, when House leadership presented the measure to rank-and-file Republicans, it was met with defiance from the conservative radicals in the House Freedom Caucus, who threatened to torpedo the proposal out of anger at being fed another stopgap bill. This left Paul Ryan with a choice. He could circumvent the Freedom Caucus and negotiate with Democrats, or he could make concessions and hope to pin blame for a shutdown on Democrats. He chose the latter, illustrating just how much conservative Republicans are still acting as if they’re in the minority and demonstrating Ryan’s reluctance to lead rather than follow the demands of his most disruptive members.

If there is a shutdown, Republicans appear more likely than not to take the blame for it. According to a new poll from ABC News and the Washington Post, 48 percent of Americans say Trump and Republicans are to blame for a potential government shutdown, compared with 28 percent who say they will blame Democrats and 18 percent who say they will blame both parties equally. Among independents, 46 percent blame the GOP.

A few months after taking office, President Trump called for a “good shutdown” to fix the “mess” in Washington. He was frustrated; Democrats had walked away with the better end of a deal that kept the government open through the end of summer. Now, a year later, Trump has gotten his wish—except this impending shutdown won’t help him win concessions or attain an advantage over his opponents. Instead, it reflects his failure—and the failure of congressional Republicans—to govern competently. That failure has left them in the absurd position of scrambling to blame Democrats for a shutdown happening under their complete control.