Republican Iowa Rep. Steve King, known for his strident anti-immigrant rhetoric, has narrowly secured a ninth term in Congress, beating Democratic opponent J.D. Scholten Tuesday night by the thinnest margin of his political career.

King’s win comes amid significant losses for GOP lawmakers in the Hawkeye state, as fellow Republican Reps. David Young and Rod Blum were both unseated by Democrats. King is the only Republican remaining in the Iowa delegation.

Though he was still projected to win, King’s victory in Iowa’s most conservative district had progressively become less inevitable as his racist rhetoric and endorsements of known white nationalists have become increasingly harder for Republicans and corporate donors to ignore.

Last week, Ohio Rep. Steve Stivers, the campaign chair of the National Republican Congressional Committee, condemned King’s conduct amid mounting concerns following the mass shooting at a synagogue in Pittsburgh. Under pressure from consumers, large corporations including Land O’Lakes and AT&T withdrew their backing for him. In response, King spent the final few days of the campaign attempting to refute accusations of anti-Semitism.

Scholten, a former minor league baseball player and first-time candidate, consistently outraised King, who has been in Congress since 2003. Scholten has advocated for establishing a path to legal status for undocumented immigrants and reforming existing visa programs to benefit year-round workers relied on by Iowa’s agriculture and farming industries.

While Scholten traversed northeast Iowa in a Winnebago, holding town hall events across the Fourth Congressional District, King received criticism for barely campaigning. He refused to debate his Democratic challenger, and didn’t make his first ad buy of the season until four days before the election, re-airing a television ad from his 2014 campaign. Despite King’s stringent anti-immigrant views and wholehearted embrace of President Trump’s pre-midterm fearmongering about Central American migrants, Trump notably did not offer any expressions of support for the controversial congressman in the final days of his reelection campaign, a move one former Trump campaign official suggested was a deliberate attempt by the president to avoid being seen as “sympathetic to white supremacists.”

Steve King attends a rally in September to highlight crimes committed by illegal immigrants. (Photo: Tom Williams/CQ Roll Call)

On Monday, before appearing at a pre-election rally with Iowa Gov. Kim Reynolds, another Republican seeking reelection Tuesday, King suggested that, after the election, maybe “we’ll have a 7-2 court,” adding that he hopes Obama-appointed Supreme Court Justices “Kagan and Sotomayor will elope to Cuba.”

King’s campaign barred a number of local and national news outlets from covering his election night event. In response to a request for credentials from the Des Moines Register, Jeff King, the congressman’s son and paid campaign staffer, wrote to the paper via email, “We are not granting credentials to the Des Moines Register or any other leftist propaganda media outlet with no concern for reporting the truth.”

Journalists from HuffPost, the Storm Lake Times, a Pulitzer Prize-winning local paper from King’s district, and even the conservative magazine Weekly Standard were also turned away from King’s election night party.

Read more Yahoo News midterms coverage: