Former Rep. Anthony Weiner (D-N.Y.) ended his campaign for New York City mayor by giving a reporter the middle finger through his car window Tuesday night.  

Weiner was caught on camera gesturing at local NBC reporter Shimon Prokupecz, who had been covering the candidate’s primary Election Day watch party. 

Other journalists snapped a photo of the obscenity, too. 

Among the five major Democratic candidates running for mayor, Weiner came in last — receiving about five percent of the vote with 99 percent of precincts reporting. 

Bill de Blasio appears to have won the Democratic primary with about 40 percent of the vote, well ahead of second place finisher Bill Thompson. However, if no candidate gets at least 40 percent of the vote, a runoff must be held between the top two vote getters. 

Election officials will recount the votes Friday, according to The Associated Press. 

Weiner’s wife, Huma Abedin, a Hillary ClintonHillary Diane Rodham ClintonTrump adds to legal team after attacks on Mueller Press: You can’t believe a word he says Feehery: March Madness MORE adviser, reportedly did not attend her husband’s party. 

Weiner's downfall was spurred by a 2011 sexting scandal in which lewd photos he sent of himself to a number of women became public. He resigned from Congress soon after the news broke. 

This summer, Weiner’s mayoral campaign took a wrong turn when revelations surfaced that the sexting scandal continued after he left public office. 

One woman, Sydney Leathers, who had revealed her prior online relationship with Weiner, tried to crash his Tuesday evening party as the polling results trickled in. 

“It’s my duty to be here,” she said, according to tweets by several reporters. 

“Why not be here?” she said, according to TV news station NY1 News. “I mean, I changed the course of the race, so I feel like it’s only appropriate.” 

The night before the primary, Weiner had a tense exchange on MSNBC’s “Last Word with Lawrence O’Donnell” during both a live TV and online interview.

“What’s wrong with you?” O’Donnell said to Weiner, provoking him.  

Joe Lhota won the Republican primary for New York City mayor Tuesday night. He will face the Democratic candidate on Election Day, which is Nov. 5.