Republican Sen. Mark Kirk of Illinois was defeated by Democratic challenger Rep. Tammy Duckworth in a tight race, giving Democrats in the Senate a key pickup Tuesday.

Kirk, a moderate Republican who has been critical of presidential Republican nominee Donald Trump, had been seeking a second term. He was identified as one of the Senate’s most endangered Republicans.

Kirk brushed off polls that showed him trailing Duckworth.

He had a disastrous moment when he questioned Duckworth’s ethnic background. He apologized, but some say the incident did too much damage to his campaign.

Duckworth, a veteran, lost both of her legs when a helicopter went down in Iraq. She has said veterans’ issues will form her legislative priorities in the Senate.

"I feel very confident, but I don't take anything for granted which is why I'm still campaigning," Duckworth told the local ABC channel before the polls closed.

Republicans hold a 54-46 majority in the Senate, including two independent senators who caucus with the Democrats. That means Democrats need to pick up just four seats to take the majority if Clinton wins the White House and can send her vice president to cast tie-breaking votes in a 50-50 Senate.

Democrats would need to pick up five seats if Trump wins.

The Associated Press contributed to this report.