Republican delegates at Utah’s state party convention delivered a setback to Mitt Romney, denying him the Senate nomination outright and forcing him into a June 26 primary. (Leah Hogsten/AP)

Mitt Romney seemed to be on a smooth path to Utah’s U.S. Senate seat, with the backing of President Trump, the blessing of retiring Sen. Orrin G. Hatch (R) and a popularity with Republicans that he earned as their 2012 presidential nominee.

Until Saturday.

Delegates at the GOP’s state convention denied Romney their nomination as Mike Kennedy, a three-term state representative who entered the race just weeks earlier, edged out the establishment favorite with 50.88 percent of the vote to 49.12 percent.

The close result secured ballot slots for Romney and Kennedy in the June 26 primary that Romney backers insist is a mere speed bump in his political revival.

Still, the delegates’ rebuff was a setback and underscored that Romney, a former governor of Massachusetts who made Utah his primary residence just five years ago, has not yet made the sale with Republican voters. Kennedy had depicted himself as a bona fide Utahan, and portrayed Romney as an establishment interloper, an attack that landed with some Republican delegates.

“We need a candidate who’s actually lived, worked and raised a family in the state of Utah,” Kennedy said last month as he entered the race. At the convention, he embraced a David and Goliath comparison, pitching himself to delegates as “your stone, ready to be flung at the foes of liberty who seek to oppress us.”

The bigger hurdles for Romney are his well-stated problems with Trump and his shifting opinions. In 2016, Romney was a prominent “Never Trumper,” calling the candidate a “phony, a fraud.” In 2018, Romney has spoken favorably of Trump’s actions on trade and suggested he is tougher on immigration than the president.

At the convention, Romney sought to cast himself as a Utahan battling Washington.

“Some people I’ve spoken to today have said this is a ‘David versus Goliath’ race, but they’re wrong,” Romney told delegates on Saturday. “I’m not Goliath. Washington, D.C., is Goliath. I’m your neighbor.”

Utah Republicans, who had long expected Romney to run for Senate, said he was still in a strong position to win after Saturday.

As the first Mormon to win any major party’s nomination, Romney won 72.6 percent of Utah’s vote in 2012, the best performance there by any Republican since Ronald Reagan’s 1984 landslide. Even before Romney made his Senate bid official, polls showed him leading any potential Democratic nominee by nearly 50 percentage points.

“There’s not a real clear path for Kennedy to win this primary,” said Boyd Matheson, former chief of staff to Sen. Mike Lee (R-Utah) and the opinion editor of Utah’s Deseret News. “He’s got a 60-day sprint against Romney, and he’s starting out with small name ID — which is not a problem for Romney.”

According to reports from the Federal Election Commission, Romney had raised $1.68 million for the short campaign; Kennedy had raised just over $289,000.

Yet going into Saturday, many Utah Republicans expected Romney to fall short — including some in the Romney camp. Officials said delegates had hoped to force a primary to increase turnout for other races and to send a message about the convention process — but had not ruled out voting for Romney in June.

Republican delegates also typically skew to the right of the primary electorate and have upset the party’s “establishment” in several races.

In 2010, three-term Sen. Robert F. Bennett won just 25.9 percent of the convention vote, ending his political career and setting up a primary later won by Lee. In 2012, Hatch fell just short of the 60 percent support he needed to prevent a primary; he went on to win that primary with 66.5 percent of the vote. In 2016, Gov. Gary R. Herbert lost the convention vote to a conservative challenger; he won the June primary by 43.5 percentage points.

Republicans familiar with Romney’s campaign said he had struggled to overcome two factors — one of which could define the primary. First, he had announced his intention to compete in the primary, gathering signatures to make the ballot, while also competing at the convention. That alienated some conservative delegates.

The bigger obstacle is his relationship with Trump.

In March 2016, Romney delivered a lengthy condemnation of Trump in Salt Lake City, urging Republican voters to back whichever candidate could stop Trump in their states’ primaries.

“He’s playing the members of the American public for suckers,” Romney said. “He gets a free ride to the White House, and all we get is a lousy hat.”

Come November, Republicans briefly fretted that Trump would lose Utah’s electoral votes, as Evan McMullin, a member of the Mormon Church, gained steam as an independent candidate. In the end, Trump won just 45.1 percent of Utah’s presidential vote, good enough for victory but less than any Republican presidential candidate had won in the state since 1992.

Since then, Trump had solidified support with Utah Republicans — Romney included. In November 2016, he had dinner with the incoming president, telling reporters he had “increasing hope” for his administration and was open to joining it as secretary of state. He was passed over for that job, but in February, he thanked the president for endorsing his Senate bid.

On the campaign trail in Utah, Romney dropped his criticism of Trump. In March, he told Utah voters that he was “more of a hawk than even the president” on immigration policy. At the convention, Romney never mentioned Trump’s name. He focused instead on his work saving the 2002 Olympics in Salt Lake City and on conservative issues where he aligned with the president.

“Thoughtless college students seek exclusion from our First Amendment,” Romney said. “Freedom of religion is under assault in court. A former Supreme Court justice calls for the repeal of the Second Amendment. State powers reserved under the 10th Amendment are trampled by federal overreach.”

Kennedy offered little in the way of contrast but won over delegates by attacking the compromises made by Republicans in Congress. He promised to repeal the Affordable Care Act — an issue many Republicans have abandoned, and one that had tripped up Romney in 2012.

“I live on a budget. You live on a budget. Our government should live on a budget,” Kennedy said.

He mentioned the occupant of the Oval Office by name and pledged to “support President Trump” if he got to Washington. Romney, who had not quite satisfied pro-Trump delegates, was speaking more carefully. In a Saturday interview with CNN, Romney evaded a question about whether he would endorse Trump’s 2020 reelection bid.

“As a person of political experience, if I endorse someone, I’ll want to know what’s in it for Utah and what help would he provide for us on key priorities in Utah,” he said.