The Republican South Jersey congressional candidate who spent much of his campaign denying charges of bigotry — even after his own party distanced itself over years' worth of racially charged comments — was handed a loss that flipped his seat to Democratic control Tuesday night.

Nearing midnight, the Associated Press measured the 2nd District race at 50-48 percent, with Democrat Jeff Van Drew claiming a win over Republican Seth Grossman.

Grossman's entire campaign was marred by controversy.  He wasn't only called a bigot by his opponent — Grossman was disowned by his party's own National Republican Campaign Committee.

Grossman has said that "Islam is a cancer" and that Muslims want to "take over our country."

He said that diversity "is a bunch of crap" and that a diversity initiative by the state Attorney General's Office would "put the public in grave danger" and turn New Jersey into Afghanistan.

He blamed President Obama for the debunked birther conspiracy theory.

He made sweeping generalizations about young black men, saying "young black men like this usually murder other young black men." He also complained about Black History Month taking up an entire month.

He was upset that the TV show "How to Get Away With Murder" had cast minorities as protagonists and white actors as the villains.

He said gay men with HIV should have been quarantined in the 1980s.

Van Drew's campaign, in a statement released just after his win, said the "tremendous victory underscores Jeff Van Drew’s broad appeal across South Jersey and his compelling message to take on the divisions gripping Capitol Hill.”

His win over Grossman returns the district's congressional seat to Democrats for the first time in more than two decades. It's part of what, for New Jersey, was a decisive blue wave — with Democrats flipping at least three districts and winning at least 10 overall for the night.

— With previous reporting by Sergio Bichao