The U.S. president used his office to stoke racial divides and scapegoat racial minorities. In rambling speeches, he painted himself as a victim of shadowy conspiracies working to end his presidency. He abused his power to remove officials for insufficient loyalty, while appointing others who were clearly unqualified for their jobs. A critic described him as “egotistic to the point of mental disease … [a] demagogue and autocrat” who “converts the Presidential chair into a stump or a throne.”

Surprisingly, perhaps, I’m not talking about the current president, Donald Trump. I’m talking about one of his predecessors, a man who was impeached 150 years ago: Andrew Johnson.

Trump likens himself to the populist outsider Andrew Jackson, whose portrait hangs in the Oval Office. Steve Bannon, Trump’s former strategist, called Trump’s inaugural address “very Jacksonian.” (Neither Trump nor Bannon appeared especially disturbed by Jackson’s fondness for slavery or his genocidal policies on Native Americans.)

But they’ve picked the wrong Andrew. The best historical parallel for the Trump presidency — and Trump the man — is Andrew Johnson, not Jackson.

Presidential historian Jon Meacham told me as much in a recent email. While acknowledging that it will be years before we see history’s verdict on the Trump presidency, he wrote: “I think it’s safe to say that [Trump] is most likely to be viewed as a disruptive and divisive figure akin to Andrew Johnson (who was impeached).”

Johnson became president when Abraham Lincoln was assassinated in 1865. The new leader faced an urgent challenge: to unify the country after years of bitter civil war. So, on the anniversary of George Washington’s birthday in 1866, Johnson spoke to the nation from the White House. But rather than striving to bring Americans together, Johnson referred to himself more than 200 times in remarks that lasted an hour. “Who, I ask,” he wondered aloud, “has suffered more for the Union than I have?”

He gave his own answer: His travails were the product of a Deep State conspiracy: “Whether by assassination or not, there are individuals in this Government, I doubt not, who want to destroy our institutions … Are they not satisfied with the blood which has been shed?”

The parallels extend to race, too.

Trump’s first mention in the New York Times was in 1973 — for “antiblack bias” in his housing projects. In recent years, he gained political prominence by spreading a debunked racist conspiracy about America’s first black president. He now treats black athletes as a Twitter piñata. And last year, Trump called Americans who marched alongside neo-Nazis and the Ku Klux Klan “very fine people.”

Johnson didn’t need any dog whistles. In 1841, before he took office, he claimed that if blacks were given the right to vote, that “would place every splay-footed, bandyshanked, hump-backed, thick-lipped, flat-nosed, woolly-headed, ebon-colored negro in the country upon an equality with the poor white man.”

Though slavery was abolished by the time he took office, Johnson actively strove to maintain white supremacy in the South and the institutions that went with it. Speaking of Frederick Douglass, the famed abolitionist, Johnson said, “I know that damned Douglass; he’s just like any [n-word], and he would sooner cut a white man’s throat than not.”

Johnson also absurdly blamed his political rivals for racial violence that he himself helped stoke, rather than placing blame on white southerners who attacked and killed African Americans who demanded the right to vote. “Every drop of blood that was shed is upon their skirts,” Johnson claimed, speaking of his political opponents. (Trump’s White House has parroted a similar accusation, claiming that Democratic mayors in “sanctuary cities” have “the blood of dead Americans on their hands.”)

Of course, the comparison only goes so far. Johnson, unlike Trump, faced an adversarial Congress that actually believed in genuine oversight. Consequently, the House impeached Johnson 150 years ago, though he managed to stay in office by a razor-thin margin of one vote in his Senate trial.

But the most intriguing comparison between Johnson and Trump is a potential one. Johnson’s biggest legacy was defined by the backlash to his presidency. His constant racial attacks on America’s freed slave population elicited political blowback that eventually led to the adoption, 150 years ago today, of the Fourteenth Amendment — the amendment that guarantees equal protection under the law.

Johnson’s bigotry perversely paved the way for an amendment later used to desegregate schools, guarantee abortion rights and legalize same-sex marriage. There’s an argument that Trump’s presidency has already had a similar effect, as his misogyny helped catalyze the #MeToo movement. Given that America is poised to become a nation where white people are a minority by 2045, it wouldn’t be remotely surprising if Trump’s inflammatory rhetoric also provoked a backlash that paves the way for real progress for racial justice.

And that, of course, is the beautiful thing about history: We’re still writing it. It’s up to us. Meacham concluded on an equally optimistic note: “If we’re lucky — and Americans usually are, in spite of ourselves — we will look back on this period as a presidential aberration. Or so I hope.”