During a meeting with McCain’s widow, Cindy McCain, ­McSally apologized for her lack of public 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.

Gov. Doug Ducey’s office announced Friday that Kyl submitted a letter of resignation effective Dec. 31 at 11:59 p.m. In his letter, Kyl called it “an honor and a privilege” to return to the Senate and fill McCain’s seat. He briefly explained the timing of his departure.

“When I accepted your appointment, I agreed to complete the work of the 115th Congress and then reevaluate continuing to serve,” Kyl wrote in his letter to Ducey, dated Dec. 12. “I have concluded that it would be best if I resign so that your new appointee can begin the new term with all other Senators in January 2019 and can serve a full two (potentially four) years.”

Republican leaders have long anticipated Kyl’s departure, and Ducey’s team has been preparing accordingly. The governor has considered appointing McSally, a favorite of Senate Republican leaders who lost a competitive race for Arizona’s other Senate seat last month.

But Ducey and his confidants have grown frustrated with ­McSally and her team in recent weeks, according to two people familiar with the governor’s thinking, who spoke on the condition of anonymity to freely discuss private conversations.

A post-election memo in which McSally’s campaign pointed to external factors rather than examining its own strategic decisions outraged the governor’s close circle, the people said. It also drew criticism from other Republicans.

Ducey encouraged McSally’s meeting with Cindy McCain. In the conversation, Cindy McCain emphasized the importance of respecting the legacy of the seat John McCain held, according to the people familiar with the conversation.

McSally often distanced herself from McCain during her campaign, a sore point for some of the late senator’s associates and loved ones.

While she touted the National Defense Authorization Act, which was named for McCain, she hardly mentioned him. President Trump, who clashed with McCain, adopted a similar posture.

Cindy McCain accepted McSally’s apology, the people familiar with the conversation said. By the end of the meeting, no commitments were requested or given, the people said.

The strained relationship between McSally and the McCain family was evident on social media Friday.

“McSally strikes me as an unwise choice for a number of reasons. She’s like an NFL team that plays down to its opponents’ level — and she’ll be tasked with running for re-election immediately,” Ben Domenech, the late senator’s son-in-law tweeted Friday.

Meghan McCain, Domenech’s wife and John and Cindy’s daughter, retweeted the post. Representatives for McSally and Cindy McCain did not immediately comment.

While McSally’s standing with Ducey is shaky, she is still a finalist for the appointment. ­Republicans expect a decision soon, and Ducey’s office said in a news release that a replacement would be named “in the near future.”

Ducey’s outgoing chief of staff, Kirk Adams, is also a possibility for the Senate seat. Adams announced late last month that he was leaving Ducey’s office, and Friday was his last day.

Senate Majority Leader Mitch McConnell (R-Ky.) and his allies have advocated appointing ­McSally, concluding that she gives the party the best chance of holding the Senate seat in the 2020 special election. The seat will also be on the ballot in 2022.

Ducey praised Kyl for agreeing to come back to the Senate earlier this year.

“When Jon Kyl returned to the Senate in September, our country faced many critical issues,” he said in a statement. “Arizona needed someone who could hit the ground running from day one and represent our state with experience and confidence — and that’s exactly what Senator Kyl has done.”

Kyl previously served in the Senate alongside McCain from 1995 until 2013.

He started his second stint during the contentious battle over Justice Brett M. Kavanaugh’s confirmation to the Supreme Court. Before rejoining the Senate, Kyl helped shepherd Kavanaugh’s nomination.

The Senate vacancy has drawn renewed attention to this year’s race in Arizona. Rep. Kyrsten Sinema (D) defeated McSally in a contest that attracted national attention.

Many Republicans have expressed disappointment in McSally’s loss. Some, including Ducey, anticipate 2020 could be a more difficult election cycle for the GOP in Arizona.

Republicans expanded their Senate majority to 53-47 over the Democratic caucus in the midterm elections. The balance will remain the same after Kyl’s replacement joins the chamber, as Ducey is required under Arizona law to pick someone from the same party as the outgoing senator.