Donald Trump had the government shutdown that he wanted.  No one should be confused about this.

The shutdown allowed Trump and Republicans to ply their poisonous politics of division.  And the shutdown provided occasion for a shakedown of Democrats, with Trump willing to shut the government down until he got billions for the wall that he had preposterously promised the Mexicans would pay for.

The record here is quite clear.  Long before the deadline, Trump tweeted that a “good shutdown” might be necessary to “fix mess!” His White House and the Republican Congress have utter scorn for federal employees, so treating these public servants shabbily is, to them, a feature, not a bug.  When Americans find public services less available, Social Security claims delayed, water systems fouled, that’s a benefit too — because it just provides fuel for Trump’s attack on government.

The blowup was utterly unnecessary.  Trump postured publicly as a supporter of the Dreamers, the hundreds of thousands of innocents, brought here as infants, who now — because of Trump’s executive order — face deportation to countries that they have never known.  Trump claimed he was ready to support a bipartisan agreement.

Democrat Dick Durbin and Republican Lindsay Graham, representing a bipartisan group, brought him that agreement.  That’s when Trump purposefully blew up the process, scorning immigrants from “s—hole countries.”  Even when Democratic Senate leader Chuck Schumer agreed with Trump’s demand for billions for the wall, there was still no deal.  He “couldn’t take yes for an answer,” Schumer concluded.

Why would Trump and Republicans force the shutdown?  The Trump campaign made that clear, rolling out a vicious television ad calling Democrats “complicit” for slayings committed by undocumented immigrants.  The White House and Republican legislators repeated endlessly scurrilous talking points that they knew were a lie: Democrats favor protecting illegal immigrants over funding our soldiers, supporting our veterans and providing services for Americans.

This is ugly, race-based politics at its worst. Republicans reveled in it, claiming they had the upper  hand.

It’s worth remembering that many recent mass murders in America — in Newtown, Orlando, Las Vegas, Charleston and Sutherland Springs — involved U.S.-born assailants.  Are Republicans, who in league with the National Rifle Association block any reform of our ridiculous gun laws, responsible for all of those murders?  That’s the logic of the Trump campaign ad slurring Democrats on immigration.

Now a deal has been reached to reopen the government, at least until Feb. 8. In theory, Democrats will gain relief for the Dreamers that is favored by some 85 percent of Americans.  Trump will probably shake out billions to waste on his wall.  Government will reopen, with the same distorted priorities.

Whether the government will finally get a real budget for the remainder of this fiscal year (which ends on the last day of September) remains to be seen. Will Trump finally take yes for an answer?

Trump and his campaign aides clearly see the political gain from parading as tough on immigration over and over again.  He said in the public meeting he held that he’d be willing to “take the heat” of a bipartisan immigration deal.  But he has preferred constantly to sow division rather than solve problems.

The second obstacle is the House leadership and caucus.  There’s a majority in the House for good immigration reform, but the Republican leadership refuses to take up a measure that would pass unless a majority of Republicans alone support it.  That makes the leadership hostage to the most right-wing faction in the party.  And a large number of them don’t want any deal, period.

Trump’s aides say he is the great dealmaker.  There’s no question if he wants a deal, there is one available.  The question remains is he prepared to make a deal.  Now, he’ll have until Feb. 8 to make up his mind.

The sad product of all this is that America’s politics will grow uglier and more divisive.  The White House and Republicans see themselves as having profited by appealing to our fears, by playing race-bait politics, by peddling hate.  They will surely keep doing what they think works.

Trump will continue to drive Americans apart — until we come together to call him and the Republicans who echo him to account.