NEW YORK >> It was an ugly, highly personal presidential election.

An unvarnished celebrity outsider who pledged to represent the forgotten laborer took on an intellectual member of the Washington establishment looking to extend a political dynasty in the White House.

Andrew Jackson’s triumph in 1828 over President John Quincy Adams bears striking similarities to Donald Trump’s victory over Hillary Clinton last year, and some of those most eager to point that out are in the Trump White House.

Trump’s team has seized upon the parallels between the current president and the long-dead Tennessee war hero. Trump has hung a portrait of Jackson in the Oval Office and Trump’s chief strategist, Stephen Bannon, who has pushed the comparison, told reporters after Trump’s inaugural address that “I don’t think we’ve had a speech like that since Andrew Jackson came to the White House.”

Trump himself mused during his first days in Washington that “there hasn’t been anything like this since Andrew Jackson.”

It’s a remarkable moment of rehabilitation for Jackson, a figure whose populist credentials and anti-establishment streak has been tempered by harsher elements of his legacy, chiefly his forced removal of Native Americans that caused disease and the death of thousands.

“Both were elected presidents as a national celebrity; Jackson due to prowess on the battlefield and Trump from making billions in his business empire,” said Douglas Brinkley, a professor of history at Rice University. “And it’s a conscious move for Trump to embrace Jackson. In American political lore, Jackson represents the forgotten rural America while Trump won by bringing out that rural vote and the blue collar vote.”

The seventh president, known as “Old Hickory” for his toughness on the battlefield, gained fame when he led American forces to a victory in the Battle of New Orleans in the final throes of the War of 1812. He did serve a term representing Tennessee in the Senate, but he has long been imagined as a rough and tumble American folk hero, an anti-intellectual who believed in settling scores against political opponents and even killed a man in a duel for insulting the honor of Jackson’s wife.

Jackson also raged against what he deemed “a corrupt bargain” that prevented him from winning the 1824 election against Adams when the race was thrown to the House of Representatives after no candidate received a majority in the Electoral College. Even before the vote in November, Trump railed against a “rigged” election and has repeatedly asserted, without evidence, widespread voter fraud prevented his own popular vote triumph.

Jackson’s ascension came at a time when the right to vote was expanded to all white men — and not just property-owners — and he fashioned himself into a populist, bringing new groups of voters into the electoral system. Remarkably, the popular vote tripled between Jackson’s loss in 1824 and his victory four years later, and he used the nation’s growing newspaper industry — like Trump on social media — to spread his message.

Many of those new voters descended on Washington for Jackson’s 1829 inauguration and the crowd of thousands that mobbed the Capitol and the White House forced Jackson to spend his first night as president in a hotel.

Once in office, he continued his crusade as a champion for the common man by opposing the Second Bank of the United States, which he declared to be a symptom of a political system that favored the rich and ignored “the humble members of society — the farmers, mechanics, and laborers — who have neither the time nor the means of securing like favors to themselves.”

Jackson, as Trump hopes to do, expanded the powers of the presidency, and a new political party, the new Democratic party, coalesced around him in the 1820s. He was the first non-Virginia wealthy farmer or member of the Adams dynasty in Massachusetts to be elected president.

“The American public wanted a different kind of president. And there’s no question Donald Trump is a different kind of president,” Sen. Majority Leader Mitch McConnell, R-Ky., said this past week. “He’s now comparing himself to Andrew Jackson. I think it’s a pretty good, a pretty good comparison. That’s how big a change Jackson was from the Virginia and Massachusetts gentlemen who had been president of the United States for the first 40 years.”

But there are also limits to the comparison, historians say.

Unlike Jackson, who won in 1828 in a landslide, Trump lost the popular vote by nearly 3 million ballots. Jon Meacham, who wrote a 2008 biography of Jackson, “American Lion,” said Jackson was “an outsider in style but not in substance” and his outlandish public pronouncements would often be followed by hours of deep conversations and letter-writing hashing out political calculations.

“He was a wild man during the day but a careful diplomat at night,” said Meacham, who said it was too early to know whether Trump, like Jackson, “had a strategy behind his theatrics,” and whether Trump had the ability to harness the wave of populism that has swept the globe as it did in the 1820s.

“The moment is Jacksoninan but do we have a Jackson in the Oval Office?” Meacham asked.

Trump’s appropriation of Jackson came after his victory. Trump never mentioned Jackson during the campaign or discussed Jackson during a series of conversations with Meacham last spring

But it is hardly unique for a president to adopt a previous one as a historical role model.

Barack Obama frequently invoked Abraham Lincoln. Dwight Eisenhower venerated George Washington. Jackson himself had been claimed by Franklin Roosevelt and his successor, Harry Truman, both of whom — unlike Trump — interpreted Jackson’s populism as a call for expanded government, in part to help the working class.

There could be other comparisons for Trump. A favorable one would be Eisenhower, also a nonpolitician who governed like a hands-off CEO. A less favorable one would be Andrew Johnson, a tool of his party whose erratic behavior helped bring about his impeachment.

Trump’s embrace could signal an about-face for Jackson’s legacy. Historians have recently soured on the slave-owning president whose Indian Removal Act of 1830 commissioned the forced removal of Native Americans from their ancestral homelands in the southeastern United States. More than 4,000 died along their journey west, a brutal match that became known as the “Trail of Tears.”

Jackson’s standing had fallen so much that in 2015, when the U.S. Treasury announced plans to replace Alexander Hamilton on the $10 bill with Harriet S. Tubman, the outcry in defense of the Founding Father — in part due to the success of the Broadway musical that tells his story — was so loud that the government changed course and opted to remove Jackson from the $20 instead.