The midterms were President Donald Trump's warm-up act for 2020.

His relentless campaigning for Republican candidates — a marathon run at the speed of a dead sprint over the final weeks — was bare-knuckled, base-centric and rarely moored to facts. And it was just a taste of what his re-election bid will look like.

That's because Trump drew a simple lesson from Tuesday's midterms: He's on the right track. Sources close to and inside the White House said Tuesday night that the president felt validated by the results.

Earlier this year, he launched a brash plan to rally his own supporters to the Republican cause by staging a series of high-voltage rallies, mostly in deep-red corners of GOP strongholds with competitive Senate races.

It was the way in which he could be most useful to GOP candidates at a time when his mere presence in tight House districts could tilt them away from Republican incumbents, but it also fit well with his raw and uncompromising style.

"Trump disappearing from the scene is literally not a viable option, so you might as well use him and get the best benefit from him," said a former Trump White House official.

He played to voters' fears and anger — over the prospect of impeachment, Supreme Court Justice Brett Kavanaugh's confirmation hearings and caravans of immigrants. He demonized Democrats as a "party of crime" and "evil people." And he rejected calls from fellow Republicans to focus on their shared economic record rather than sending troops to the southern border and trying to rewrite the Constitution's guarantee of birthright citizenship.

His critics in the Republican Party believe his strategy and tactics hurt GOP candidates outside of Trump territory, and may continue to do so for years to come. That may be one of the reasons Democrats seized control of the House for the first time in eight years. But Trump can credibly claim that he'd achieved his goal of safeguarding the Republican majority in the Senate despite the House loss.

In his mind, he was right and they were wrong. And his loyalists don't see him altering his formula.

"Trump is who he is," said Matt Schlapp, chairman of the American Conservative Union and a close Trump ally.

Republicans were relieved Tuesday night that they were not swept away by a "blue wave" of Democratic victories that his rivals had hoped for. But the Democratic takeover of the House, which was carried out in suburbs and exurbs across the country, held some warning signs for the party.

After all, most Americans think the country is on the wrong track and don't approve of the job Trump is doing. Beyond that, some Republican strategists say, the president's dark rhetoric is permanently alienating voters who need to be courted by the GOP.

"What he’s done with the racist emphasis on immigration and his general conduct, he’s limited any growth among the faster-growing demographic groups in the country," said John Weaver, a veteran GOP strategist who advised Ohio Gov. John Kasich's Republican presidential primary campaign in 2016. "Every day the country gets a little younger and it gets a little less white and you project that to 2020 and the math starts working dangerously against Republicans pulling off an inside straight in a presidential election."

In that way, Trump's base appeal echoes the course taken by Hillary Clinton, his rival for the presidency in 2016. He is focused so narrowly on trying to turn out the people who already agree with him that he may have lost the ability to persuade anyone who doesn't. The only political answer to that is to squeeze more votes out of a narrow base.

But, having invested little in party politics before he became a politician a few years ago, Trump may not care as much about the state of the GOP a decade from now as others in the party.

He just has one more election to win, and he's unlikely to change course.