Updated on January 19 at 4:17 p.m.

Sarah Palin, the former vice-presidential nominee and Tea Party superstar, endorsed fellow Republican Donald Trump for president on Tuesday. The news came in a statement, but Palin is also appearing at a rally with Trump in Ames, Iowa, on Tuesday.

Palin’s endorsement seems at once perplexing and logical.

On the perplexing side is the fact that Trump—rhetoric aside—isn’t the most conservative candidate in the Republican field. Take Ted Cruz, whose spokesman took a preemptive shot at Palin over the endorsement Tuesday morning. Back in 2012, when Cruz was running an underdog campaign for U.S. Senate, Palin was one of the most prominent national conservatives to endorse him publicly, helping push Cruz to victory. Trump, in contrast, is a heterodox conservative, having previously backed Democrats, and having delivered stirring defenses of things like progressive taxation during Republican debates. Pointing to their very different lifestyles—New York City scion of wealth vs. working-class Westerner-turned-hardy-Alaskan—National Review deemed Trump and Palin “the oddest of political couples.” What gives?

But then there’s a natural affinity between Trump and Palin. Both are candidates who have capitalized on their ability to speak to the grievances of white, working-class Americans. They delight in inflammatory rhetoric—getting a rise out of the right people is much of the fun—and despise the press, even as their success depends in large part on managing to capture journalists’ attention. Both have a tendency to extemporize, producing sentences that are impossible to diagram and often to understand. Both have been reality-TV stars, though Trump rode his television fame to political success, while Palin rode her political success to a television contract.

This similarity is true as far as it goes, but it undersells the depth of the similarity between Trump and Palin. And in fact, that similarity owes something to the very same Trumpian deviations in conservative orthodoxy that might otherwise seem to separate him from Palin.

In 2011, Joshua Green traveled to Alaska to profile Palin for The Atlantic, and found that her actual record there was not quite what lower-48 liberals might have imagined:

As governor, Palin demonstrated many of the qualities we expect in our best leaders. She set aside private concerns for the greater good, forgoing a focus on social issues to confront the great problem plaguing Alaska, its corrupt oil-and-gas politics. She did this in a way that seems wildly out of character today—by cooperating with Democrats and moderate Republicans to raise taxes on Big Business. And she succeeded to a remarkable extent in settling, at least for a time, what had seemed insoluble problems, in the process putting Alaska on a trajectory to financial well-being. Since 2008, Sarah Palin has influenced her party, and the tenor of its politics, perhaps more than any other Republican, but in a way that is almost the antithesis of what she did in Alaska.

In other words, Palin was a pragmatist and a dealmaker, just like Trump—guided by a fundamentally conservative worldview, but not especially interested in or bound by orthodoxy. (You’re unlikely to find either curled up with the complete works of William F. Buckley.) Like Trump, she was willing to take on big business and call for new taxes where they seemed warranted. Trump, too, has a mixed political past in his closet: On the one hand, years of race-baiting, but on the other, past support for abortion, donations to liberal candidates, registration as a Democrat.

But Trump and Palin were both able to spot, and then position themselves to take advantage of, opportunities of the moment. They understood that if they were able to say the right things to the right groups, it would block those more complicated political pasts from view. As a bonus, that rhetoric would cause earnest concern (and worse) from the Republican establishment—but establishment condemnation just strengthened the affection that alienated conservatives already felt for both Trump and Palin. Meanwhile, both have continued to deviate from orthodoxy even after becoming stars: Palin has repeatedly blasted sexism in politics; Trump has shrugged off various criticisms that he’s essentially a big-government politician. True rogues aren’t just dissidents from the liberal consensus—they’re outcasts in their own parties, too.

What will Palin’s endorsement do for the Trump campaign? Perhaps not much. Palin isn’t the star she once was. Fox News dropped her contract as a commentator; a 2015 speech in Iowa was widely derided even in formerly friendly precincts; and as Harry Enten noted last summer, her favorability even among Republicans has tumbled.

That really just raises two more questions about Trump’s current lofty position. After all, Palin was also floated as a candidate for this cycle, but opted out of the race. One issue is why Palin didn’t reach the same level that Trump has now. Sure, she was picked as the vice-presidential nominee, but that turned out to be her apogee; as the American people got to know her better, her support dwindled over time. What did she do wrong that Trump has done (politically, at least) right? Was she not as disciplined? (Trump, for all his foibles, manages to keep tightly to a few messages even as he improvises.) Was sexism a factor? Alternatively, perhaps Trump’s political future looks a lot like Palin’s: Maybe one lesson from her career is that this method yields short-term support, but can only succeed for so long. In any case, endorsing Trump would makes perfect sense. Palin’s clan of Mama Grizzlies is largely gone, and so is her moment. Trump is one of her few remaining proteges. Palin won’t ever be president, but if helping make Trump the nominee could be her legacy, it wouldn’t be a bad revenge on the GOP establishment.