Washington (CNN) Even by Washington's standards, the sequence of busted negotiations, partisan dysfunction, and blame games that shut down the federal government at midnight on Friday was baffling.

That's because on the major issues that are driving the most tense political moment yet in Donald Trump's presidency, the two parties are broadly in agreement. Most Democrats and Republicans want to find a way to stop the deportation of nearly 700,000 people brought illegally to the US as children. They all agree that a children's health insurance plan should be extended, and to hear them tell it, no one on either side wanted to shutter the government, despite the fact their frantic last-minute talks ended in a huge collective failure.

"Almost everybody on both sides doesn't understand how we ended up here," Senate Majority leader Mitch McConnell said early Saturday morning.

"Most of this stuff we agree on," said the Kentucky Republican.

Yet a combination of long-building distrust between the parties and a President who billed himself as the ultimate dealmaker but who couldn't make a deal took the nation over the cliff and into political jam that is risky for both sides.

In the end, neither party wanted to blink first, and there is a good reason why: Each is prisoner of its base of most committed voters, for whom immigration especially is an existential issue.

As the clock ticked past midnight and the government officially closed down, feverish political calculations were taking place all around the US Senate floor, where the dramatic climax of the shutdown drama played out. The general impression was of a political system and a governing class that is simply not up to the task of dealing with the polarizing issues facing the American people.

"I don't think anybody really knows what's going on," GOP Sen. John Kennedy of Louisiana told reporters on Friday night.

Democrats effectively decided that the time had come to fight, refusing to vote to fund the government until the White House and Republicans acted to protect beneficiaries of the Deferred Action on Childhood Arrivals (DACA) program.

The Democratic leader, New York Sen. Chuck Schumer, is taking a gamble that the shutdown will break bad on Trump and the GOP -- since the party controls the entire machinery of government.

"Every American knows the Republican Party controls the White House, the Senate, the House, it is their job to keep the government open," Schumer said a half-hour into the shutdown, seeking to pin the blame on the President.

For Trump, the shutdown is particularly embarrassing since it went into effect on the exact moment that the calendar flipped over to January 20 -- the anniversary of his inauguration as President. It also undercuts one of the central ideas of Trump's entire political project: his claim that only he had the skills to fix the mess in Washington. And so far, Trump has shown that his vaunted deal-making skills are not transferring well from real estate to politics.

Democrats, burned by Trump's rejection of a bipartisan deal last week on DACA, have no confidence that the President can be trusted to do a genuine deal on the issue without them using their maximum moment of leverage. There are also questions over what Trump is actually seeking to get out of the negotiations, since he has several times reversed course on potential deals with Democrats. Even McConnell admitted this week he did not know what kind of bill on funding the government the President would sign.

Like Trump, Democrats are also finding their room for maneuvering on immigration is narrow. The party leadership is under intense pressure from its aggravated left-wing grassroots base that is in revolt against Trump and believes that their own congressional leaders have been too timid in drawing a line in the sand over DACA before this point.

But Schumer must also protect red-state Democrats facing tough re-election fights in states Trump won last year who fear being branded by Republicans as pro-amnesty.

In a new CNN poll on Friday, 56% said that approving a budget agreement to avoid a shutdown was more important than acting on the DACA program. Even among Democrats, only 49% said that DACA is a more important issue than keeping the government open.

So the impact of the shutdown on public opinion is not clear cut and -- given the fact that Democrats had appeared to be starting to build a blue wave with the potential to rob the GOP of control of the House and Senate -- anything that changes the political terrain represents a risk for the Democrats.

The White House meanwhile, in refusing to give ground on DACA, is showing the extent to which Trump is a prisoner of the hardline rhetoric of his 2016 campaign on immigration. It will now take a huge political leap for Trump to make a concession on the issue.

Trump's instinct is always to go on the attack. So a few minutes before midnight, White House press secretary Sarah Sanders issued a vehement statement, branding the imbroglio the "Schumer shutdown," and warning that Trump would no longer discuss the DACA issue until Democrats funded the government. In a nod to Trump's own loyal supporters, who lap up his bombastic rhetoric, she slammed Democrats as "obstructionist losers."

The length of the shutdown and who pays the political price for it will be dictated by how the American people apportion the blame -- and whether Schumer's or Trump's gamble pays off. The fact that last-minute talks between the parties failed to bridge the gap between them suggests that it may be some time before there is a resolution. For the impasse to end, one side is going to have to back down, and the political consequences are huge for both of them.

The immediate impact of the shutdown will be cushioned by the weekend, but by Monday, when federal workers are furloughed, the political ground may begin to shift. Polling and public perception over who is most to blame for the deadlock may end up deciding which side blinks first.

In his speech after efforts to reach a Senate compromise broke down, Schumer took the White House's spin and reversed it, branding the episode the "Trump shutdown."

The longer the situation goes on, the stronger that argument might become.

"If it drags on for weeks, it will be Donald Trump's meltdown -- the deal maker who couldn't make a deal," said CNN presidential historian Douglas Brinkley.

One of the mysteries of Friday night's drama was the fact that Trump stayed behind closed doors in the White House, and was not in the center of negotiations. He did host Schumer for talks on Friday afternoon when the Democratic minority leader claimed to have pushed hard for a deal -- even putting the issue of funding for Trump's promised border wall on the table.

But Schumer said the President failed to put any pressure on Republicans in the Senate to play along, effectively accusing Trump of lacking political courage and backing off "at the first sign of pressure."

Questioning Trump's capacity to cut deals is unlikely to sit well with the President. So his reaction through the weekend -- and his Twitter feed on Saturday morning as he marks the end of his first year in office -- will be worth watching.