It was a rollercoaster ride for New York City voters, but tonight they chose to jump off.

Democratic voters went to the polls today and rejected the comeback bids of former Rep. Anthony Weiner and former New York Gov. Eliot Spitzer after Democratic primary races that made the city the spectacle of the nation.

In the end, voters opted for the candidates with less tabloid appeal -- New York City public advocate Bill De Blasio in the race for mayor and Scott Stringer, the Manhattan borough president, who won the comptroller race.

Weiner, who launched a bid to replace New York City Mayor Michael Bloomberg after resigning from Congress for sexting women online, saw his political fortunes tumble so precipitously it was hard to believe that months ago he was a front runner in the contest.

Weiner, who won only 5 percent of the votes, conceded the race Tuesday night.

"We have the best message. Sadly, I'm an imperfect messenger," he told supporters.

With 97 percent of precincts reporting, de Blasio led the field of mayoral candidates with 40.7 percent, though it was still unclear whether he would maintain the 40 percent of the vote he would need to avoid a runoff election, according to The Associated Press.

Competing for a potential runoff slot is former New York City Comptroller Bill Thompson with 26 percent of the vote.

The winner of the Democratic race will face Joe Lhota, a former deputy mayor to Rudolph Giuliani and former chairman of the N.Y. Metropolitan Transit Agency who won the G.O.P primary.

Three quarters of voters said they had a negative impression of Weiner, according to exit polls.

Spitzer, another former politico who resigned in disgrace, sought to recover from the prostitution scandal that ended his once-promising career as governor by being elected the city's comptroller.

Hours after polls closed, Stringer was declared the winner of the NYC comptroller primary. Spitzer took 48 percent of the vote to Stringer's 52 percent.

De Blasio's rise in the polls was fueled by the fall of Weiner, whose campaign imploded after it was revealed that he continued having inappropriate sexual relationships with women online, even after resigning from Congress in disgrace for similar behavior in 2011.

The fluid mayoral contest to replace the longstanding mayor, Michael Bloomberg, featured five candidates all fighting to define New York City's post-Bloomberg era.

De Blasio's early lead in exit polling came after early polls in July showed him near the bottom of the pack of candidates, which in addition to Quinn, Weiner and Thompson, featured current New York City Comptroller John Liu.

De Blasio, backed by progressive Democrats, pitched himself as a fierce opponent of Bloomberg's policies -- including one of the most controversial, the "stop-and-frisk" policy in which city officers were encouraged to proactively stop and interrogate anyone suspected of criminal behavior.

Many African Americans and Democrats said the policy disproportionately subjected young black and Hispanic men to that treatment.

According to the AP, exit polls showed that most voters said "stop and frisk" resulted in the harassment of innocent people. Primary voters also said they wanted the next mayor to move away from Bloomberg's policies. And a full two-thirds of primary voters said it was a bad idea to allow Bloomberg to serve a third term in office.

Though their sexual dalliances evoked many comparisons, Weiner and Spitzer's political paths were actually quite different.

While Spitzer managed to avoid any new scandals surfacing, Weiner seemed to drown in them. As New York's attorney general, Spitzer developed a reputation as a hard-charging and ambitious prosecutor. While in Congress, Weiner had more of a reputation as a fiery favorite of the cable news circuit than a legislator.

Both men were initially dogged by questions about their past indiscretions, but only Spitzer managed to avoid a reprisal of the accusations that ended his political career in 2008.

When a woman, Sydney Leathers, emerged in late July claiming that even after Weiner left Congress he engaged in an inappropriate relationship with her online by sending inappropriate pictures and messages, Weiner's campaign began to unravel soon after.

With his campaign manager jumping ship just days later, an intern writing a tell-all account in a New York tabloid, and a top aide using vulgar and sexist terms to denounce the intern, the Weiner saga became the fodder of major newspapers, television and late night jokes.

Weiner's troubles were also compounded by his candidacy's residual impact on former Secretary of State Hillary Clinton's likely political future.

The 23-year-old Leathers appeared outside of his campaign headquarters to further remind voters about her sordid connection to Weiner.

"I'm outside of Weiner headquarters just as a reminder of his impulse control problems and why he shouldn't be mayor. I'm a physical reminder of that," Leathers said. "I just felt that it was necessary for me to be here as a reminder of why the people of New York shouldn't vote for him and shouldn't take him seriously, unless they want a Mayor 'Carlos Danger.'"

Meanwhile, Spitzer's comeback seemed to go along on a different track.

The former governor had jumped into the race late -- just five days before the deadline to submit signatures for his candidacy. He challenged Stringer, who had until then been running unopposed for the comptroller job.

"I was surprised that he got in, but it was masterful that he got in late so there could be no opposition and he caught Stringer unawares," said Hank Sheinkopf, a Democratic strategist who worked with Spitzer in his Attorney General campaign. "He expected to walk into this with no opposition whatsoever, which is most unusual in New York City."

And at one point it looked like Spitzer could go all the way, with polls showing him ahead of his Stringer by a nearly 20-point margin.

Spitzer had all but acknowledged that he sought the lower office as a signal of repentance for his past misdeeds -- and an opportunity for political rebirth.

"What has surprised me is that this is the greatest circus New York has ever seen," said Sheinkopf, who is a consultant for another mayoral candidate, Bill Thompson. "Better than the ones in Madison Square Garden."

ABC News' Ben Waldron and The Associated Press contributed to this report.