With more than 80 percent of precincts reporting Tuesday night, Anthony Weiner was far behind in the city's Democratic mayoral primary, with about 5 percent of the vote.
Another politician with a sex scandal in his past, Eliot Spitzer, was lagging in the contest for city comptroller, with Scott Stringer, the Manhattan borough president, leading with 52 percent of the vote.
Weiner, the onetime front-runner, gave a high-energy and at times emotional concession speech, referring to himself as an "imperfect messenger" but saying he wouldn't stop "fighting for the middle class and those struggling to make it."
Weiner had been in political exile since he resigned from Congress in 2011 for sending women lewd online messages and pictures. He got into the mayor's race in May, and aside from a few dust-ups with hecklers, was largely well-received at first, holding the lead for most of June and July.
But then an obscure gossip website named The Dirty released X-rated exchanges between Weiner and a 22-year-old woman, Sydney Leathers, that took place well after the candidate quit the House.
Weiner and his wife, top Hillary Rodham Clinton aide Huma Abedin, held an emergency news conference in which the candidate vowed to stay in the race.
"I love him, I have forgiven him, I believe in him, and as we have said from the beginning, we are moving forward," Abedin said.
But Adebin was not seen again on the campaign trail. When Weiner gave his concession speech Tuesday night, she was not with him at the podium.
One woman who was there was Leathers.
"Why not be here," she told reporters. "I'm kind of the reason he's losing. So, might as well show up."
She said Weiner needed "to stop being an embarrassment to the city of New York. He's going to continue this behavior. If it's not going to be me, it's going to be some other girl."
Weiner's online sexting pseudonym, Carlos Danger, became a big joke on late-night TV. He plunged in the polls, and his behavior became more erratic.
He called a 69-year-old Republican candidate "Grandpa" at an AARP-sponsored forum. He increasingly engaged in angry exchanges with voters, including a shouting match in a Brooklyn bakery last week when a customer uttered a crude insult.
Weiner shot back: "It takes one to know one, jackass."
Spitzer resigned as governor in 2008 after admitting he paid for sex with call girls. In exile, he bounced around television as a pundit. Then, just four days before the deadline, he announced he was running for comptroller.
He took an early lead in the polls, but the race tightened dramatically in recent weeks as the Democratic establishment rallied around his main opponent, Scott Stringer, Manhattan borough president.
Unlike Weiner, who made a point of fielding voters' questions about his scandal, Spitzer apologized a few times and then refused to talk about it.
He largely eschewed retail campaigning -- situations that could have led to awkward exchanges with voters -- in favor of national TV interviews and a big television ad campaign, financed with his own millions.
But he could not avoid all mention of the scandal. The city's tabloids hounded him about the state of his marriage; Spitzer said he was still married, but his wife never appeared on the campaign trail.
And a madam who claimed to have supplied Spitzer with prostitutes announced that she, too, would be running for comptroller. But Kristen Davis' bid ended when she was arrested by the FBI for allegedly peddling prescription drugs.
Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.