(CN) - After 43 days - and a contentious recount - Republican Martha McSally has been declared the winner of the Arizona Congressional District 2 race on Wednesday, by just 167 votes.
The Maricopa County Superior Court tweeted the news Wednesday morning that "Judge Katherine Cooper ruled Martha McSally received the highest number of votes for Congressional District 2."
McSally ousted incumbent Democrat Ron Barber, who has held the seat since former Congresswoman Gabrielle Giffords resigned in 2012 to recover from injuries she received in a mass shooting in 2011.
A tally on Election Day had McSally ahead by just 161 votes, triggering an automatic recount. Barber lost a bid to halt the recount process on Thanksgiving Day, when a federal judge ruled that the now-former Congressman hadn't shown that election officials acted improperly by throwing out 133 early and provisional ballots for irregularities.
The recount began on Dec. 1.
This was McSally's third run for the District 2 seat, comprised of Cochise County and parts of Pima County, including most of Tucson. She lost to Barber by less than 1 percent of the votes in 2012.
Despite the recount, McSally - a former Air Force colonel - had already joined freshmen in Congress and been given a spot on the armed forces and homeland security committees.
McSally will be sworn in on Jan. 6.
Read the Top 8
Sign up for the Top 8, a roundup of the day's top stories delivered directly to your inbox Monday through Friday.