DES MOINES, Iowa (AP) -- Ted Cruz, a fiery, conservative Texas senator loathed by his own party's leaders, swept to victory in Iowa's Republican caucuses, overcoming billionaire Donald Trump and Florida Sen. Marco Rubio. Among Democrats, Vermont Sen. Bernie Sanders rode a wave of voter enthusiasm to a virtual tie with Hillary Clinton, long considered her party's front-runner.
Cruz's victory in Monday's caucuses was a harsh blow to Trump, the supremely confident real estate mogul who has roiled the Republican field for months with controversial statements about women and minorities.
The victory in the first Republican nominating contest ensures that Cruz will be a force in the presidential race for weeks to come -- if not longer. The first-term Texas senator now heads to next week's New Hampshire primary as an undisputed favorite of the furthest right voters, a position of strength for drawing in evangelical voters and others who prioritize an abrupt break with President Barack Obama's policies. Cruz's victory was a testament to the massive get-out-the-vote operation that he built up in Iowa.
Perhaps most importantly, Cruz's win denied Trump a huge opportunity to gain momentum heading into New Hampshire. Trump parlayed his fame as a real estate mogul and reality television star into large rallies, extensive media coverage and national poll numbers that before Monday night had established him as the Republican front-runner.
"Iowa has sent notice that the Republican nominee and next president of the United States will not be chosen by the media, will not be chosen by the Washington establishment," Cruz told supporters.
Trump came in second, only slightly ahead of Rubio, who achieved a credible showing by nearly besting Trump. Rubio's stronger-than-expected finish could help cement his status as the favorite of mainstream Republican voters who worry that Cruz and Trump are too caustic to win the November general election.
The Iowa caucuses kicked off voting in the 2016 presidential race, a tumultuous contest with unexpected candidates challenging both the Republican and Democratic establishments.
Candidates faced an electorate deeply frustrated with Washington. While the economy has improved under Obama, the recovery has eluded many Americans. New terror threats at home and abroad have increased national security concerns.
In the Democratic race, nearly complete tabulations showed Clinton and Sanders in a virtual tie.
Democratic caucus-goers were choosing between Clinton's pledge to use her wealth of experience in government to bring about steady progress on Democratic ideals and Sanders' call for radical change in a system rigged against ordinary Americans. Young voters overwhelmingly backed Sanders.
Clinton, the former secretary of state, U.S. senator and first lady, entered the Democratic race as the heavily favored front-runner. She was hoping to banish the possibility of dual losses in Iowa and in New Hampshire, the nation's first primary, where she trails Sanders, who is from the neighboring state of Vermont. Two straight defeats could set off alarms within the party and throw into question her ability to defeat the Republican nominee.
For Clinton's supporters, the tight race with Sanders was sure to bring back painful memories of her loss to Obama in the 2008 Iowa caucuses.
Clinton appeared before supporters to declare she was "breathing a big sigh of relief." But she stopped short of claiming victory and declared herself ready to press forward in "a real contest of ideas."
Sanders had hoped to replicate Obama's pathway to the presidency by using a victory in Iowa to catapult his passion and ideals of "democratic socialism" deep into the primaries.
"It is too late for establishment politics and establishment economics," said Sanders, who declared the Democratic contest in Iowa "a virtual tie."
With the race too close to call, Sanders' aides said they had been told by the Iowa Democratic Party that it did not have results from several precincts and had asked the campaigns to help get the missing information. The party said it was awaiting results from a "small number of outstanding precincts" and had reached out to the campaigns for help contacting the chairs from those sites.
Despite Sanders' strong showing, he still faces an uphill battle against Clinton, who has deep ties throughout the party's establishment and a strong following among a more diverse electorate that plays a larger role in primary contests in February and March.
Iowa has long led off the state-by-state contests to choose delegates for the parties' national conventions. Historically, a victory has hardly assured the nomination, but a win there, or even an unexpectedly strong showing, can give a candidate momentum and media attention, while a poor showing can end a candidacy.
Trump sounded humble in defeat, saying he was "honored" by the support of Iowans. And he vowed to keep up his fight for the Republican nomination.
"We will go on to easily beat Hillary or Bernie or whoever the hell they throw up," Trump told cheering supporters.
Rubio cast his stronger-than-expected finish as a victory.
"We have taken the first step, but an important step, to winning the nomination," the Florida senator said at a campaign rally in Des Moines.
Some of the establishment Republican candidates have been focusing more on New Hampshire than Iowa, including former Florida Gov. Jeb Bush, Ohio Gov. John Kasich and New Jersey Gov Chris Christie.
The caucuses marked the end of at least two candidates' White House hopes. Former Maryland Gov. Martin O'Malley ended his longshot bid for the Democratic nomination and former Arkansas Gov. Mike Huckabee dropped out of the Republican race.
The state's 30 Republican delegates to the national convention are awarded proportionally based on the vote, with at least eight delegates going to Cruz, seven to Trump and six to Rubio. Even without a declared winner, The Associated Press awarded all but one of the 44 Democratic convention delegates. Clinton led Sanders 22 to 21, with the remaining delegate to be awarded to the statewide winner.
Associated Press writers Julie Pace in Washington and Ken Thomas, Catherine Lucey, Lisa Lerer, Scott McFetridge and Scott Bauer in Iowa contributed to this report.