Republican Rep. Martha McSally may have been defeated by Democratic Sen.-elect Kyrsten Sinema in the midterms, but she will still be able to serve in the Senate this year: On Tuesday, Arizona Gov. Doug Ducey announced he was appointing McSally to the other Senate seat, which was vacated by John McCain.

McSally will become the 25th woman serving in the Senate at the start of the 116th Congress, a record high, and will succeed Sen. Jon Kyl (R). Kyl will step down at the end of the year following a brief time in McCain’s seat after McCain’s 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. I thank her for taking on this significant responsibility,” Ducey said in a statement.

McSally is expected to run for the seat in a 2020 special election, setting the stage for a potential marquee contest in a battleground state. The seat will also be on the ballot in 2022.

“I am humbled and grateful to have this opportunity to serve and be a voice for all Arizonans,” McSally said in statement issued by Ducey’s office. She said she looked forward to working with Sinema.

Behind Ducey’s waffling decision

Ducey’s decision comes after weeks of tense relations with McSally and her political strategists. Last week, Ducey and his close confidants were frustrated with McSally — to the point that the governor’s interest in appointing her had diminished, according to two people familiar with this thinking.

But McSally remained a finalist and in recent days, she has tried to improve her standing with Ducey and the other Republicans she clashed with during her campaign.

On Friday, McSally apologized to McCain’s widow Cindy McCain for her lack of praise for the senator on a defense bill named in his honor, according to two people familiar with the conversation, who spoke on the condition of anonymity to describe a private discussion. Ducey encouraged the meeting.

McSally, a onetime Trump critic, reinvented herself as a staunch supporter of the president during her Senate campaign. She largely avoided mentioning John McCain, who had traded public criticism with the president.

Her posture bothered McCain’s friends and family. Cindy McCain emphasized the importance of respecting the legacy of the seat during her meeting with McSally, according to the people familiar with their conversation.

A memo McSally’s campaign strategists issued after the election became another source of tension. Ducey and his confidants were angry with the document, which blamed her loss on external factors rather than reflecting on strategic decisions they made.

McSally’s race against Sinema was contentious, expensive and close. McSally is a former Air Force pilot who was first elected to the House in 2014. She has emphasized her military background on the campaign trail.

What McSally brings to the position

In the end, Ducey concluded that McSally would give the party the best chance of holding onto the seat in two years. Senate Majority Leader Mitch McConnell (R-Ky.) has long seen McSally as the best bet to keep the seat in GOP hands and has advocated for her behind the scenes.

McSally brings an established fundraising network, relationships with Republican officials and name recognition, thanks to the many advertisements she ran during this year’s campaign.

Democratic strategists have mentioned several potential candidates in their party who may run for the seat in 2022. They include Mark Kelly, a former astronaut and the husband of former congresswoman Gabrielle Giffords.

Ducey wrestled with his decision in part over his desire to ensure a strong Republican candidate would be on the ballot in 2020. The governor believes that election could be more difficult for Arizona Republicans than this year’s vote, according to the people familiar with his thinking.

Republicans will hold 53 seats in the new Congress. The Democratic Caucus will have 47 members.

Elizabeth Warren shouldn’t hide that she was once a Republican

She didn’t register as a Democrat until 1996, when she was in her late 40s

How Neera Tanden’s mom was dragged into a messy fight between Sanders and Clinton supporters

The 78-year-old became collateral damage

The Mueller report exposes Sarah Sanders’s extravagant falsehood

The truth comes out in an illuminating passage