District Republicans line up outside of the Loews Madison Hotel to vote in the D.C. Republican primary on Saturday, March 12, 2016. (Pete Marovich/For The Washington Post)

Sen. Marco Rubio of Florida edged out Ohio Gov. John Kasich in Saturday’s Republican primary in the District, where voters waited in line as long as three hours to cast ballots.

Many of them called it one of the most significant GOP primaries here in years.

The allocation of the 19 delegates at stake was not clear as of late Saturday night. However, José Cunningham, chairman of the city’s Republican Party, said the allocation would be in proportion to the votes received.

Announced results gave Rubio 37.3 percent of the 2,839 votes cast. Kasich was close behind with 35.5 percent, a difference of less than two percentage points. That suggested that each might get nearly the same number of delegates.

Donald Trump and Sen. Ted Cruz (Tex.) trailed by substantial margins. Trump got 13.8 percent of the votes and Cruz 12.4 percent.

District Republicans meet, greet and vote on Saturday, March 12, 2016. (Pete Marovich/For The Washington Post)

Others on the ballot received less than 1 percent each.

Among those waiting to vote was Erika Walter, 27.

“It’s exciting to see this many Republicans in D.C.,” Walter said as she waited her turn in a line that snaked out of the polling place in the Loews Madison Hotel, down 15th Street NW and wrapped around L Street. As of 3:30 p.m., hundreds stood in line, many enduring a drizzle. At one point, the line stretched around three sides of a square block.

Two weeks ago, Trump, the billionaire businessman and Republican front-runner, won a straw poll conducted by the party, followed by Rubio, Cruz, Kasich and retired neurosurgeon Ben Carson, who has since dropped out of the race. The ballot in the District still carried Carson’s name as well as the names of two other candidates who have withdrawn: former Florida governor Jeb Bush and Sen. Rand Paul (R-Ky.).

With 19 delegates at stake — as many as Hawaii but more than Vermont and Delaware — D.C. Republicans say they pull more weight than many people might think. Party officials said that holding their primary earlier than usual allows them to have a say while the nomination contest is still competitive.

In the overwhelmingly Democratic city, Republicans make up 6 percent of registered voters. Many said they were heartened by the turnout.

Nevertheless, the 2,839 voters amounted to only about half of the approximately 6,000 who, according to party leaders, cast ballots four years ago when voting was spread throughout the city’s precincts.

Tracking the race to the Republican nomination

Patrick Mara, executive director of the District’s Republican Party, ascribed the long lines to a combination of voter enthusiasm and the single voting location. Delays occurred because officials could rent only 15 voting machines that would accommodate the large ballot for delegates, he said.

“It’s a completely different animal when you have everyone coming to one central location downtown,” Mara said. “We did the best we could under the circumstances.”

The polling place opened at 10 a.m. and was to close at 4 p.m., but Mara said that anyone in line by 4  could vote. The party rented a smaller hotel room until 9 p.m. to allow those of the Jewish faith to vote after sundown on the Sabbath. About 20 did so.

In other contests Saturday, Cruz won nine of the 12 delegates being chosen in Wyoming, according to the Associated Press. Others will be awarded at a convention. Rubio and Trump won one apiece. One delegate was uncommitted. Hillary Clinton won the Democratic caucus on the Northern Mariana Islands and earned four delegates, while Sen. Bernie Sanders of Vermont picked up two.

The day had its share of Republican star power.

Ben Ginsberg, the Republican lawyer who helped draw up the working rules of the party’s National Convention, was in line with a plan to vote for “his friends” — activists who ran as uncommitted delegates.

“This turnout is impressive,” Ginsberg said. “This is not the tasseled lobbyist class. These are real people coming out to vote.”

C. Boyden Gray, who served as White House counsel under President George H.W. Bush and ran as a delegate supporting Cruz, mingled with voters. Nearby, Joshua Bolten, who served as White House chief of staff to President George W. Bush, manned the #NeverTrump table.

“Who would’ve thunk in Washington, D.C., you’d see Republicans get excited about something,” Gray said. “Normally, we’re such a minority that we don’t matter, but this race is obviously attracting enormous attention.”

Bolten declined to say whom he supports but said he was urging people to vote for delegates “who will oppose Donald Trump at all stages of the convention, assuming it’s contested.” He said he believed there was anti-Trump sentiment behind the turnout.

“A substantial part of the party is steadfastly opposed to the front-runner,” Bolten said.

Tim Schnabel, 35, a State Department employee, had hoped to support Bush or Paul. Leaving the polls, and wearing a #NeverTrump sticker, he said he had reluctantly supported Cruz. “My sense is that at this point in the race, Cruz is the only one nationally who has a chance to deny Trump those 1,237 delegates,” he said.

Rita Ferrall, 60, a small-business owner running as a Trump delegate, attributed anti-Trump sentiment to the fact that the District is a government town.

“I think there’s a percentage of people who are against Trump because . . . he’ll make some visible changes,” said Ferrall, who lives in the Chevy Chase neighborhood of the city. “These people are used to business-as-usual in Washington.”

None of the voters interviewed said recent violence at Trump rallies was a factor in their decision. Most said they had made up their mind earlier, while some said the violence reinforced their feelings about Trump.

“For me, it reconfirmed that we need to nominate a candidate who doesn’t foment violence,” said Hudson Hollister, 34, of Capitol Hill. He said he was for Rubio.

“It didn’t surprise me,” said Walter, who said she planned to vote for Rubio because of his “values and integrity,” adding that “Trump is a volatile character, so you can expect his supporters to be the same.”

David Weigel contributed to this report.