What was John Kasich doing there on Tuesday night, and why did he seem so happy? Yes, the governor of Ohio had just won the primary in his home state. But it was his first and only win in 37 contests to date, and it came on the same night that it became mathematically impossible for Kasich to earn a majority of delegates before the Republican convention in July. Even if he were to win 100 percent of the vote in every primary and caucus remaining, there are simply not enough delegates left on the table.

Yet Kasich was jubilant as he took the stage in a Cleveland suburb, in front of a marquee reading “As Goes Ohio, So Goes the Nation.” (Nobody outside of Ohio ever says this, and the saying originally comes from a reference to Maine.) He recounted having tried to slip into a local restaurant, only to be greeted by cheers. “To have people believe in you, and to believe that you can bring people together and strengthen our country—I have to thank the people of the great state of Ohio,” he said. “I love you.”

That Kasich is one of the last three candidates remaining in the Republican race is a result few would have foreseen at its outset. In a year of dark mutterings and angry fulminations, Kasich has distinguished himself with a relentlessly positive message, cheekily dubbing himself the “Prince of Light” at one point. But he is not still in the race by dint of any particular success, as evidenced by his delegate count; he is there by dint of sheer stubbornness. He won’t get out, so he’s still in.

Obstinacy and optimism, in fact, have been the twin hallmarks of Kasich’s 30 years in politics, so perhaps it is natural that those two qualities account for his persistence. While he has never been a top-tier contender in this race, there has always been a sound theoretical argument for his candidacy, as I wrote in a profile of Kasich last year:

If only, Republican voters might be thinking, there were a candidate who could appeal to blue-collar voters but also mingle with the GOP establishment. A governor who’d proven he could run a large state but who also had national experience. Someone who’d won tough elections and maintained bipartisan popularity in an important swing state. A candidate whose folksy demeanor and humble roots would contrast nicely with Hillary Clinton’s impersonal, stiffly scripted juggernaut. That’s Kasich’s pitch, in a nutshell.

There was also, I noted, another side to Kasich: “He’s kind of a jerk.”

Lobbyists in Columbus warn their clients before meeting the governor not to take it personally if he berates them. A top Ohio Republican donor once publicly vowed not to give Kasich a penny after finding him to be “unpleasantly arrogant.” As a congressman, Kasich sometimes lashed out at constituents—one who called him a “redneck” in a 1985 letter got a reply recommending he “enroll in a remedial course on protocol”—and when Kasich was thrown out of a Grateful Dead concert for trying to join the band onstage, he allegedly threatened to use his clout to have the band banned from D.C. As I was writing this article, Kasich’s press secretary, Rob Nichols, helpfully emailed me the thesaurus entry for “prickly,” sensing that I would need it.

Those descriptions were written before Donald Trump got into the race and upended Kasich’s and every other candidate’s calculations. Early on in the campaign, it seemed like Kasich might try to compete with Trump for the pitchforks-and-torches crowd by emphasizing the ranty, unfiltered part of his demeanor. But at some point, he and his advisers clearly calculated that staying on the sunny side of the street was the way to stand out, even if it made him seem painfully out of step with the times. “I will not take the low road to the highest office in the land,” he said on Tuesday, proceeding to an extended riff about the sources of humans’ sense of purpose in life.

His sunniness has made Kasich the candidate who contrasts most sharply with Trump and the other remaining candidate, Ted Cruz, in both tone and platform. While Trump vows to build a wall on the border, Kasich insists that would be impractical. While Trump depicts immigrants as a threat, Kasich argues they should be treated humanely. (He is for a path to legal status for undocumented immigrants, but not citizenship.) Rather than play on people’s resentments, Kasich’s pitch is for “leaving no one behind.”

Kasich’s positivity has had the added virtue of not getting him into a spat with Trump, who has swiftly dispatched almost every candidate who has gone after him. That positivity slipped over the last week as the two fought for Ohio—Trump aired television ads attacking Kasich as an absentee governor, taunted him on Twitter, and criticized him for having voted for the North American Free Trade Agreement while in Congress. Kasich, in turn, accused Trump of creating a “toxic environment” that was encouraging violence at his events. Trump has yet to come up with a cutting epithet for Kasich as he has his other antagonists—perhaps it helps that Kasich is neither especially low-energy, nor little, nor a liar—and whether he deigns to do so in the coming days could indicate how much of a threat the front-runner considers the Ohioan.

A surprising number of Trump supporters I have met have told me they also like Kasich, and the idea of Kasich as a ticket-mate for Trump has gained a small amount of traction. Asked about the prospect last week, Kasich did not definitively rule it out. In 2000, when he briefly sought the presidency but dropped out before votes were cast, Kasich was vetted for a slot on the ticket with George W. Bush. But he didn’t get that and was not offered a Cabinet position, a result he blamed on the fact that, when Dick Cheney was defense secretary in the 1980s, Kasich, then a congressman, opposed the B-2 bomber and succeeded in reducing its production.

This year, the Republican establishment has never flocked to Kasich, even though he has many qualities they ought to find attractive—the long political resume, the record of competence, the business-friendly platform. That might have been because there were so many other options, particularly the similar-on-paper Jeb Bush. (Early in the campaign, Kasich said he decided to run because of Bush’s unimpressive early performance.) It might have been because of his temperament, which is far from polite and refined. It might have been because they doubted that someone with his moderate tendencies could appeal to a base of voters thought to be further to the right. It might have been because the establishment was always too disorganized and few in number to control this year’s nominating process.

Kasich vowed Tuesday to “go all the way to Cleveland and secure the Republican nomination.” His campaign released a memo arguing, with little specificity, that no candidate would be able to win a majority of delegates, that most of Rubio’s former supporters would flock to Kasich, and that the electoral map was “shifting significantly in our favor.” With three candidates left, Kasich stands as the standard-bearer for an optimism that borders on delusion. The GOP’s other choices are Trump, whom many consider a dangerous demagogue, and Cruz, whom the former speaker of the House referred to on Wednesday as “Lucifer.” Given those choices, Kasich hopes delusional optimism will start to look pretty good.