SALT LAKE CITY — Unprecedented numbers of Utahns flooded voting sites across the Wasatch Front for the state's first presidential preference caucus, resulting in long lines, major delays and even ballot shortages.

Ted Cruz was projected to win Utah with a big lead over the other candidates. The Associated Press called the race for Utah about 12:30 a.m. Wednesday.

At 11:30 p.m., AP reported that Bernie Sanders had defeated Hillary Clinton for the Utah Democratic vote.

Many caucuses were ill-equipped to handle the unexpected deluge, prompting some to complain that voting was disorganized and chaotic. And online voting — a first for Utah's GOP — proved to be problematic for some Republicans who complained they ran into difficulties when attempting to cast their votes.

"It was a madhouse," said Linda Stewart, the legislative chairwoman for District 49 that included the 50 GOP precincts voting at Brighton High School.

Stewart estimated at least 2,100 Republicans showed up to vote at the high school. Traffic was backed up at least a half-mile before the 7 p.m. caucus began, and all the area parking lots quickly filled up.

"It's entirely unusual," Claire Francis, legislative District 25 chairwoman, said of the massive turnout at Democratic voting site at Emerson Elementary School in Sugar House. "It's unusual on so many levels. I don't even want to get into it."

About 5,000 were expected at the elementary school voting site, but nearly 9,000 turned out, said caucus host Claire Francis.

After going through 5,000 ballots before voting closed, caucus leaders set up a printer to pump out reams of provisional ballots for hundreds of people still in line.

"Our lease on the room ended three minutes ago," Francis said at 9:03 p.m., with hundreds of people still waiting for ballots. "The count is definitely going to be delayed."

The Democratic Party estimated that about 75 percent of its caucus locations ran out of ballots Tuesday night. At a precinct in Lehi, a ballot shortage prompted a couple of voters to get 500 more printed at their own expense.

The party expected record turnout but still underestimated the number of voters, said Yándary Zavala, spokeswoman for the Utah Democratic Party. After the caucuses closed, party officials estimated a turnout of more than 80,000.

"We've never seen anything like this in the political history of Utah as far as I know," Utah Democratic Party Chairman Peter Corroon said. "Everybody was helping tonight. I was delivering ballots myself to miles away from our offices here just to make sure we had everybody with enough ballots."

Corroon said it's hard for a party to hold a presidential caucus or primary, and he called on the Republican-controlled Legislature to fund such elections.

"Political parties with four staff and a couple of hundred volunteers can't handle the number of voters that turn out in a primary or caucus election," he said.

As for Republicans, Utah GOP Chairman James Evans said turnout would exceed 200,000, well over the record 125,000 in 2012.

At a Republican caucus at Bingham High School in South Jordan, about 3,000 squeezed shoulder-to-shoulder in the hallways while trying to make their way to individual precinct meetings. Some who couldn't fit in classrooms stood outside in hallways while listening to the discussion through open doors.

"People are turning out in droves," Evans said.

Republican caucuses reported long lines, leading party officials to instruct caucus organizers to have extra blank paper to be used as ballots, said Cindie Quintana, GOP party spokeswoman.

Evans said he didn't consider the ballot shortage a problem. Evans said it was clear from the morning online voting activity and the number of people requesting absentee ballots that "turnout was just going to be phenomenal," and party officials from around the state were advised earlier in the day to be ready for crowds.

"Running out of ballots is a good thing. That means you had more people than you anticipated," he said. "That's why we can go back a generation and just use regular paper. That's what we're doing."

In addition to caucus night voters, 59,000 Republican voters signed up to cast their ballots online. Some Utah Republicans complained they ran into difficulties when they attempted to vote online.

Bountiful resident Greg Ericksen, said he couldn't advance after filling out the initial page of the online voting form that requests personal information, which produced error messages saying his information was inaccurate.

"I must have tried eight or nine times without success," he said.

"Anytime you have humans and technology, you're going to have these kinds of issues," Evans said, noting that "a significant number" of voters registered to vote online had successfully cast their ballots.

Both the state party offices and the help line set up by Smartmatic, the Florida-based company handling the online voting for the GOP, were "overwhelmed" with calls from Utahns having problems casting their vote, said Hugh Gallagher, Smartmatic's business development adviser.

The bulk of the calls were from Utahns who wanted to register Tuesday to vote online, not realizing they'd missed the party's Thursday deadline, Gallagher said.

Quintana declined to say whether higher-than-expected volume was causing some of the other online issues.

Mark Thomas, Utah's director of elections and chief deputy to Lt. Gov. Spencer Cox, said the state's website also had some difficulties for about an hour and a half Tuesday due to high traffic.

"Obviously it's been a couple decades since we've done a presidential preference conference, so that causes some excitement," he said. "It's still a close race on both sides of the aisle, and candidates have been spending a lot more time and money in Utah than we've seen in years past, so all of that is translating into a lot of interest for voters."

Contributing: Dennis Romboy, Morgan Jacobson, Associated Press

Email: kmckellar@deseretnews.com

Twitter: KatieMcKellar1