WASHINGTON - US Senator Bernie Sanders registered a surprise win in Michigan’s primary Tuesday night, chipping away at Hillary Clinton’s dominance in the Democratic presidential race, while Republican Donald Trump swept to victory in Michigan, Mississippi and Hawaii, overcoming fierce efforts to blunt his momentum.

Clinton had hoped wins in Michigan and Mississippi would make her all but certain to claim the Democratic presidential nomination she lost to Barack Obama eight years ago. But Sanders, a leftist, narrowly won Michigan in an upset that ensures a longer campaign. As the primary season heads toward its final phase, the two front-runners seem to be living in alternate political realities.

The Democratic Party is close to coming to terms, although Sanders’ first-place finish in Michigan could signal unexpected strength in the Ohio and Wisconsin primaries just ahead.

The Republican Party is on the verge of going to war even as Trump is tightening his hold on the nomination.“I don’t think I’ve ever had so many horrible, horrible things said about me in one week,” Trump said happily at a news conference in Jupiter, Florida, as he thanked his supporters for ignoring pleas by party elders to oppose him. “This has been a fantastic night,” Sanders told reporters in Miami. “Hello, Ohio!” Clinton declared at a rally in Cleveland.

Clinton started out on top last year, in such a strong position as the prospective nominee that most of the party’s rising White House hopefuls decided to wait for another time to run. Sanders has caught the imagination of young people and progressives, but he has struggled to make significant inroads among the African-American voters who are an essential part of the Democratic base.

That’s why Clinton won Mississippi by such a lopsided margin that networks declared her the winner as soon as polls closed, based on surveys of voters as they left polling places. She carried black voters by 8-1.

In Michigan, however, Clinton carried African Americans by 35 percentage points, a wide margin but smaller than in the South; Sanders won whites. She carried Democrats; he carried independents. He won eight in 10 voters under 30; she won seven in 10 of those 65 and older.

Even so, Democratic primary voters in Michigan said either candidate would be acceptable to them: Two-thirds would be satisfied with Clinton as the nominee; seven in 10 would be satisfied with Sanders. Among Republicans, divisions are deeper.

Nearly half of the Republican voters in Michigan would be dissatisfied with Trump as the nominee. In a nationwide NBC News/Wall Street Journal poll released Tuesday, Trump held a narrow 30%-27% lead over Texas Senator Ted Cruz among likely Republican voters, but in hypothetical head-to-head contests, a majority favored Trump’s rivals over him.