Updated

Anthony Weiner, after losing badly in the New York mayoral primary Tuesday night, bid farewell to the campaign in a manner befitting the foul-mouthed candidate -- by flipping the bird after delivering his concession speech.

The timeless image, showing the disgraced former congressman giving the middle finger to a New York reporter, was captured by NY1 News and posted to Twitter Tuesday night.

The picture quickly surged across social media, putting a bow on the entire wild ride of Weiner's failed attempt at a political career comeback.

Though Weiner once led the pack as he asked voters for a second chance on the heels of his sexting-while-in-Congress scandal, that advantage quickly diminished after he admitted to another bout of sexting after he left Congress.

He finished with just 5 percent of the vote. Public Advocate Bill de Blasio was in the lead, with about 40.2 percent of the total vote, which puts him a whisker above the 40 percent threshold needed to avoid triggering an automatic Oct. 1 runoff.

If he cannot maintain that, he will face former city Comptroller Bill Thompson, who has 26 percent, for a potentially grueling three-week, one-on-one showdown, with the winner advancing to face Republican nominee Joe Lhota in the general election.

But it may take a week or more before it is known whether that battle will be fought at all.

City Council Speaker Christine Quinn, the early front-runner who was hoping to become the city's first woman and openly gay mayor, finished third at 16 percent, followed by current city Comptroller John Liu at 7 percent. Weiner was last.

De Blasio, more than any other candidate, benefited from the rapid fall of Weiner, who was leading in the polls before he was felled by his old demons.

A gossip site revealed that Weiner used the online handle Carlos Danger to continue to send X-rated messages to women even after he resigned from Congress in 2011 for similar behavior.

His ill-fated campaign had two final embarrassments in its last minutes: One of his online paramours, Sydney Leathers, tried to crash his primary night rally and then Weiner was caught making the obscene gesture at reporters as he was driven away.

NBC affiliate reporter Shimon Prokupecz tweeted that he was the target of the gesture. "Just had the pleasure of getting the middle finger from Anthony Weiner after his security staff pushed us out of the way," he wrote. He later added: "He drove away smirking."

An NY1 reporter then provided the snapshot.

The Associated Press contributed to this report.