Herb Doby, a delegate from Goshen County, casts his vote for Wyoming delegates during the Wyoming GOP convention on Saturday in Casper, Wyo. (Jenna Vonhofe/Casper Star-Tribune via AP)

Sen. Ted Cruz (R-Tex.) continued his romp through the Republican Party’s state conventions Saturday, winning 14 delegates in Wyoming to complete a near-sweep of the state. At the same time, in conventions in Virginia, Georgia and South Carolina, Cruz-friendly activists won delegate slots in congressional districts that had voted for someone else in the primaries.

The events capped off three remarkable weeks for Cruz in the sort of cloistered party meetings where grass-roots organizers can dominate. Cruz, the only Republican candidate to campaign in Wyoming, told delegates here that their votes could help him win “a battle in Cleveland,” where the party may host its first contested convention in 40 years.

“If you don’t want the convention in Cleveland to hand the election to Hillary Clinton — which is what a Donald Trump nomination does — I ask you to support this slate,” Cruz said.

These conventions came after Trump had spent much of the week panning Colorado for using a similar system to award 34 total delegates. As in Wyoming, activists had gathered at little-hyped local conventions, won places at the state convention, then voted for the national delegates — all while giving Cruz nine of the Wyoming delegates available in the March 1 county caucuses.

The GOP front-runner complained that the contest had been “rigged” against him, a charge that Colorado Republican leaders strongly denied, noting that they’d been using the same system since the 2004 presidential election.

“Look at what happened in Wyoming,” Trump told supporters in Syracuse, N.Y., while 475 Republicans in Casper’s Parkway Plaza convention center were marking their ballots. “Look at what’s happening in Colorado, where the people never got a chance to vote and they’re going nuts out there. They’re angry — the bosses took away their vote.”

Trump’s campaign was late to recognize the importance of the state conventions, much less the local contests that determined who could vote at those state conventions. In Wyoming, that effectively meant that Trump’s supporters were arriving at a marathon where Cruz had already run the first 25 miles.

On Thursday, Sarah Palin canceled a planned trip to speak on Trump’s behalf in Casper. On Friday night, Palin called a pro-Trump delegate candidate, Clara Powers, and encouraged her to take the slot. She did so, getting a polite reception and closing with a poem about how the party establishment would try to steal the vote in Cleveland.

“We know how Wyoming is going to go,” Trump senior adviser Paul Manafort conceded in an interview before the vote.

Manafort said that the Cruz campaign’s success in winning delegate assignments “confuses the issue” of Trump’s overall lead in the GOP race. “There are places where we’re going to make up for what we’re losing — in terms of bodies, not votes,” Manafort said.

It was a different story in Virginia’s 10th Congressional district. Both the Cruz and Trump camps ran slates of national-delegate candidates who pledged their support on the second vote in Cleveland. While the district had voted for Sen. Marco Rubio, the Florida Republican’s subsequent collapse left the convention open to conservative activists and reluctant anti-Trump voters, disappointed in the remaining choices.

William E. Wilkin, a history teacher at the high school that was hosting the convention, voiced the frustration of many Republicans who have watched their candidates fall one by one during a nasty primary season.

His allegiance has shifted from Carly Fiorina to Rubio to, now, Cruz, Wilkin said during his campaign speech to be a national delegate.

But he was not hopeful about the looming showdown in July.

“Frankly, ladies and gentlemen, Cleveland will be a train wreck,” Wilkin said, eliciting jeers from the crowd.

Wilkin missed out on a delegate slot, while Cruz endorser and state Sen. Richard H. Black (R-Loudoun) won. Black, who has a formidable political operation in Loudoun County, also worked to ensure that the conference was stacked with Cruz supporters. An ultraconservative who is often at odds with the state Republican Party establishment, Black marveled at the level of enthusiasm for Trump or Cruz in a congressional district that Rubio won handily during the state’s primary election in March.

“If there’s anyone that the RNC would like to see lose, it would be Ted Cruz or Donald Trump,” Black said, referring to the Republican National Committee. “I’m sure there are members of the establishment that would want something to happen to either one of these candidates along the way.”

In South Carolina’s 1st Congressional District, carried narrowly by Trump in February’s primary, Cruz supporters won three delegate slots. In Georgia, early results from the state’s 14 congressional districts showed that Cruz had succeeded in picking up delegates in corners of the state that Trump won in the primary. Across the state, Republicans began meeting at 10 a.m., and some gatherings stretched until midafternoon as Trump and Cruz supporters clashed over the credentials of people seeking delegate seats.

Georgia’s 11th Congressional District perhaps best embodied Trump’s struggles on Saturday. He won the district with 35 percent of the vote, so he will get two of the district’s votes in the first round of balloting at the convention, and Rubio will get the other. But two Cruz supporters — his Georgia chairman, Scott Johnson, and former congressman Robert Barr — won two of the three delegate slots.

In the first round of balloting in Cleveland, Georgia Republicans will cast 42 votes for Trump, 18 for Cruz and 16 for Rubio, who has exited the race. If there are subsequent rounds, Cruz supporters required to vote for Trump could switch to the U.S. senator from Texas.

In Wyoming, Trump’s local operation was clearly outmatched, even though a number of attendees said they supported him. Six Trump supporters ran for delegate slots, but Our Principles PAC, the best-funded anti-Trump group, piled a table with more anti-Trump brochures than there were voters who could read them. As they navigated the halls, some Republicans could be heard grousing that the “fake” Trump literature was more plentiful than the actual Trump merchandise sitting near Cruz’s hospitality suite.

From that suite, Cruz’s state chairman, Ed Buchanan, had a hard-won but pleasant task: Making sure that just 14 of the many Cruz-supporting Republicans won the delegate slots. The campaign distributed an 8-by-11-inch sheet with Cruz’s image and the names of its preferred 14 delegates. Later in the day, the conservative Gun Owners of America released another brochure, with the same slate. The Cruz slate’s main competition came from pro-life groups and an unaligned “Wyoming first” push, which proposed their own slates, not necessarily bound to anyone. In the end, 12 members of Cruz’s official slate prevailed, and the remaining two delegates separately pledged to support the senator, according to Buchanan.

The third remaining Republican candidate for president, Ohio Gov. John Kasich, put up only token efforts in Wyoming and Virginia. In Casper, his campaign was represented by Gov. C.L. “Butch” Otter (R-Idaho), an early endorser, who spent more time talking about the needs of Western states than about Kasich himself. Cruz and Trump had staffers monitoring the slow Wyoming vote count; Kasich did not.

But midday Saturday, Kasich’s campaign announced via Twitter that it had won a plurality of delegates assigned by Indiana’s state convention — an even more opaque process, closed to the news media. “Our team outhustled the other campaigns,” Kasich tweeted.

Olivo reported from Virginia. Ed O’Keefe contributed reporting from Washington.