WEST VALLEY CITY, Utah (AP) — Mitt Romney was forced into a Republican primary in his bid for U.S. Senate in Utah after losing a nomination battle Saturday at the state’s far-right-leaning GOP convention.

Romney remains the heavy favorite overall to replace long-serving Sen. Orrin Hatch in November and said he was ready to keep campaigning hard.

If he had won the party delegate vote at the convention, he would have bypassed a primary altogether. Instead, he was edged out by state lawmaker Mike Kennedy, who got 51 percent of the vote to Romney’s 49 percent.

GOP voters will decide between the two in a June 26 primary.

Romney previously secured his spot on the primary ballot by gathering 28,000 voter signatures but said Saturday that choice was partly to blame for his loss.

Gathering signatures to make the ballot is unpopular among many conservative delegates in the state who say it dilutes their ability to choose a candidate.

The issue prompted hours of debate, shouting and booing at the convention.

Romney, 71, went up against 11 other candidates at the convention, including one dressed as Abraham Lincoln, complete with vest and bow tie. Some candidates questioned Romney’s past criticism of President Donald Trump.

Romney pushed back against critics who said he’s an interloper in Utah politics by referring to his role in staging the 2002 Winter Olympics in Utah.

“Some people I’ve spoken with have said this is a David vs. Goliath race, but they’re wrong,” Romney said in his speech. “I’m not Goliath. Washington, D.C., is Goliath.”

Kennedy, a doctor and lawyer, framed himself as an underdog taking on the “Romney machine.” At one point, he pitched in to sweep up tiny paper American flags that had been shot from a confetti cannon hours before.

Delegate Matt Murdoch, 28, said he voted for Kennedy because he’s a family doctor serving many of his neighbors in Alpine, south of Salt Lake City.

Stay-at-home mother Michelle Cluff said she liked Romney’s experience and believes he is ready to get to work as a senator.

Romney was governor of Massachusetts from 2003 to 2007. While in office he signed legislation that greatly expanded access to health care through state-level subsidies and individual mandates to purchase insurance, much like Obamacare.

Romney asked for delegates’ votes after spending two months on the campaign trail visiting dairy farms, taking selfies with college students and making stump speeches in small towns.

After his failed 2012 presidential campaign, he moved to Utah, where he gained popularity after running as the first Mormon presidential nominee of a major political party.

He’s worked to keep the focus on state issues rather than his history of well-documented feuds with Trump, whom he called a “con-man” and a phony during the 2016 race. Trump fired back that Romney “choked like a dog” during his own White House run.

The two men have shown signs of making peace, and Romney has accepted Trump’s endorsement for Senate. But Romney said Saturday he hasn’t decided whether he’ll endorse the president’s 2020 re-election bid.

(© Copyright 2018 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)