Republican Rep. Martha McSally, just weeks after losing one of the midterms' tightest and most contentious Senate races, was appointed by Arizona Gov. Doug Ducey on Tuesday to fill the state’s other U.S. Senate seat.

McSally will serve for at least the next two years in the seat that was held by longtime Arizona Sen. John McCain until his death in August.

“With her experience and long record of service, Martha is uniquely qualified to step up and fight for Arizona’s interests in the U.S. Senate,” Ducey said in a statement.

Ducey had appointed former Sen. Jon Kyl to the seat in September, but Kyl, after serving for several months, announced plans to resign at the end of the year. According to Ducey’s office, Kyl’s resignation will be effective Dec. 31.

McSally was defeated by Democratic Rep. Kyrsten Sinema in this year’s midterm election for the seat held by retiring GOP Sen. Jeff Flake. Her appointment means she will now serve alongside her opponent, something Ducey noted in his statement.

“I thank her for taking on this significant responsibility and look forward to working with her and Senator-Elect Sinema to get positive things done,” Ducey said.

McSally will serve until the 2020 election, when voters will elect someone to serve the final two years of McCain's term.

Democrats hope that the state swings again in 2020 and are expected to target it both in the presidential race and the contest for McCain's seat. U.S. Rep. Ruben Gallego, former astronaut and current gun control advocate Mark Kelly and former Arizona Attorney General Grant Woods, who left the GOP this year, have all considered running as Democrats for the post.

The intense interest in the seat was a factor in Ducey's convoluted decisions. He initially appointed Kyl while the governor himself was campaigning for re-election. By picking Kyl, Ducey dodged tough political decisions that could have complicated his own re-election bid.

McSally is a two-term congresswoman who was long considered for the Senate by the state's GOP establishment. The first female combat pilot, McSally rose to the rank of colonel in the Air Force before entering politics.

The Associated Press contributed to this report.