RICHMOND — A state legislator and son of a Cuban immigrant running on a tough-on-crime platform won the Republican nomination for Virginia attorney general Sunday, in the first results of the statewide convention that will also decide the nominee for governor.

Virginia Del. Jason S. Miyares (R-Virginia Beach) bested three other candidates in the “unassembled” convention, in which about 30,000 Republicans cast ranked-choice ballots at 39 locations across the state on Saturday.

In November, he will face the winner of the Democrats’ June 8 primary. Attorney General Mark Herring (D), seeking a third term, faces a challenge for the nomination from Del. Jay Jerrauld C. “Jay” Jones (D-Norfolk).

Miyares did not immediately respond to a request for comment after his win, but thanked Virginia for his victory in a tweet.

“I’m humbled by your support and together we can defeat Mark Herring, keep our communities safe, and start the Virginia Comeback,” he wrote.

Tallying was scheduled to resume Monday in Republicans' marquee contest, a hard-fought seven-way race for the gubernatorial nod.

The state legislator faced an unexpectedly strong challenge from Chuck Smith, a former Navy judge advocate general who drew attention for anti-Muslim comments in 2017, when he unsuccessfully sought the same nomination.

“We don’t need more Muslims, mosques or refugee resettlements until we protect the citizens we have,” he said at a forum in 2017.

Smith ran this time with an endorsement from Michael Flynn, President Donald Trump’s former national security adviser, who pleaded guilty to lying to the FBI and later was pardoned by Trump. State Sen. Amanda F. Chase (R-Chesterfield), a gubernatorial candidate who ran as “Trump in heels,” endorsed Smith, and vice versa.

A former state prosecutor, Miyares argued during his campaign that Herring and liberal legislators in Richmond had made the state less safe.

Miyares has called for a state constitutional amendment that would ban parole for violent offenders. He also says he will defend gun rights and act as a check on the Democratic-controlled state legislature.

He combined his message of an uncompromising approach on crime with an appeal to immigrants that highlighted his background. Miyares said in a campaign launch video that his mother had “fled Cuba with nothing” and that he is proud of his roots.

Miyares raised more money than his opponents and received the endorsement of a number of establishment Republicans, including former governors Robert F. McDonnell and George Allen. He was also endorsed by Sen. Marco Rubio (R-Fla.).

Results in the attorney general’s race were delayed by hours Sunday after party and campaign officials realized tape seals on the doors of a ballroom where ballots were stored overnight had been broken.

The discovery sent them into an investigative flurry that included interviewing a housekeeper, calling lawyers and reviewing security footage. They eventually were convinced that nothing was amiss; the housekeeper had simply carted in coffee, water and soft drinks.

The episode, which set back the counting by about two hours, highlighted the tremendous angst and suspicion that continue to surround the proceedings. The party that has made election integrity a national rallying cry has seen its own internal nominating process beset by allegations that it has been rigged to favor one candidate or another.

Distrust was running so high during Saturday's convention that two campaigns even tailed a car carrying ballots from Prince William County to Richmond because they did not trust the two party-
appointed couriers.

"They are keyed up to an elevated level," said Rich Anderson, chairman of the Republican Party of Virginiaoutside the ballroom.

Around 3 p.m., a team of about 50 began hand-counting an estimated 30,000 ballots, a painstaking process that three gubernatorial contenders demanded amid fears that vote-tallying software the party had considered could not be trusted.

Arrayed at 152 tables, each representing a state GOP chapter, the counters sorted the ballots into four piles, one for each candidate in the attorney general’s race.

As counting got underway, the room had the hushed sobriety of a library, despite the presence of one man dressed as a circus ringmaster, complete with top hat and red satin tails.

“I just wanted to fit in with the circus that is this process,” said John Findlay, a former state party executive director who observed the counting on behalf of Chase.

The costume, which Findlay rented before getting wind of the security breach at the hotel, was a reference to other incidents that have plagued the nominating contests in the previous months.

The party’s governing board was paralyzed for months by a standoff over whether to pick its nominee at a convention or in a state-run primary, how to structure the convention and how to tally the votes. Various candidates accused each other of trying to rig the process.

Amid that distrust, the party leaders tried to make sure ballots were secure. After Republicans voted Saturday, officials put the ballots in sealed boxes and transported them to the ballroom that night.

Most came by car, but boxes from Southwest Virginia were flown in on a six-seat plane, and ballots from Tangier Island started their journey on a boat.

The Republican Party of Virginia had promised to hire armed security to guard the room overnight, but none appeared. Anderson said he thought the hotel was making the arrangements for a security guard, but the hotel apparently thought the party would handle it.

Party officials then scrambled to hire an off-duty police officer, who arrived at the hotel front doors around 2:30 a.m., Anderson said.

But a housekeeper entered the ballroom through a back door early Sunday morning, snapping the tape as she brought in water, soda and coffee, and inadvertently causing the vote-counting delay.

Seven Republicans are vying to be the party’s gubernatorial nominee: Chase; Del. Kirk Cox (Colonial Heights), a former House speaker; retired Army Col. Sergio de la Peña; former think tank executive Peter Doran; businessman Pete Snyder; former Roanoke sheriff Octavia Johnson; and Glenn Youngkin, a former Carlyle Group executive.

First eliminated in the attorney general nomination was Leslie Haley, a Chesterfield County supervisor and law firm owner. Next was Jack White, an Army veteran and former clerk for Supreme Court Justice Samuel A. Alito Jr.

Miyares and Smith were in a tight race until the third round of counting.

Kay Crews, a Dallas-based expert in ranked-choice voting whom the party brought in to serve as head teller, suggested that the counting start with the attorney general race because of its relatively small size, Anderson said. The idea was that vote-counters would get a feel for ranked-choice ballots, something new for a statewide contest in Virginia, before moving on to the governor’s race.

While initially they had planned to count votes in the governor's race last, Anderson announced Sunday that he had decided instead to turn to it next because of the amount of interest in the result.

That makes the last race to be counted the six-way race for lieutenant governor. Candidates vying for that position are Puneet Ahluwalia, a political and business consultant in Fairfax County; Lance Allen, a national security company executive in Fauquier County; Del. Glenn R. Davis Jr. (Virginia Beach); former state delegate Timothy D. Hugo (Fairfax); Maeve Rigler, a lawyer; and former delegate Winsome Sears (Norfolk).

Jouvenal reported from Washington.