The choice facing Arizona Gov. Doug Ducey was an unenviable one. Should he choose a John McCain-style, sharp-tongued critic of President Trump to replace the late senator? A White House loyalist? A member of his own inner circle?

In the end, Ducey (R) chose perhaps the one candidate who could satisfy all the competing camps: Jon Kyl, a former senator who in his retirement has at times voiced criticism of Trump’s style but whose shepherding of Supreme Court nominee Brett M. Kavanaugh has also landed him in the good graces of the White House.

Up for reelection in November, Ducey faced the dilemma ensnaring other Republicans in 2018: avoid angering Trump, who has a viselike grip on the party, while placating the GOP establishment epitomized by McCain, who dominated state politics for more than three decades.

“Jon Kyl is a safe choice for Governor Ducey as he tries to balance his reelection and the McCain and Trump factions of the Arizona Republican Party,” said Dan Eberhart, an Arizona-based Republican donor. “Senator Kyl is filling the shoes of John McCain and Barry Goldwater before him. That is much easier said than done, but he is a very high-quality, consensus pick.”

Kyl, 76, said he was willing to serve through at least the end of the current Congress, injecting a degree of uncertainty about the future of the seat. If Kyl leaves in January, Ducey or his successor must appoint a Republican to fill the seat, according to state law.

Once he is sworn in Wednesday, Kyl will cast crucial votes in the coming weeks on Kavanaugh’s nomination, government spending and possibly billions for a U.S.-Mexico border wall, and perhaps another round of tax cuts.

If he remains through 2020, he could face a vote on repealing the Affordable Care Act, which the GOP failed to scuttle in 2017 largely because of McCain’s thumbs-down.

Ducey’s choice of Kyl comes after an emotional week.

Ducey asked Kyl if he would accept the appointment on Aug. 25, the day that McCain died, according to two people close to the governor. Kyl tentatively said he would but added that he needed to check with his wife, Caryll. Within days, he said he was a firm yes.

Kyl confirmed the details recounted by the people close to the governor, calling them “essentially correct.”

Trump had sparked outrage after he initially refused to issue a statement lauding the Vietnam POW as a “hero” and keep flags lowered to half-staff until his interment on Sunday. He later reversed course, but several of McCain’s longtime colleagues, family members and other allies heaped criticism on the president — directly and indirectly — over five days of services honoring McCain’s life, culminating in a scathing denunciation of Trump by the senator’s daughter Meghan McCain during a tearful eulogy at Washington National Cathedral.

By Tuesday evening, it was clear that Ducey’s appointment of Kyl had succeeded in bringing about a rare moment of harmony, with Trump, McCain’s family and Sen. Jeff Flake (R-Ariz.), a vocal critic of the president, praising the move.

“Jon Kyl will be an extraordinary Senator representing an extraordinary state, Arizona,” Trump said in a tweet congratulating Kyl. “I look forward to working with him!”

Both Meghan McCain and her mother, Cindy, tweeted their support for Kyl, whom they described as a friend of the family and a statesman who is well suited to take up McCain’s mantle in the Senate.

Kyl served alongside McCain in the Senate from 1995 until 2013, rose to the No. 2 GOP leadership post and was a consistent conservative vote. Since his retirement, he has worked as a lobbyist for pharmaceutical and defense companies, among others, records show.

At a news conference announcing his choice on Tuesday, Ducey declared that there is “no one in Arizona with the stature of Senator Jon Kyl.”

With McCain’s passing, the Senate has lost a voice that served as a strong check on Trump’s actions. Those who know Kyl say he is more likely to be a bridge-builder than a Trump antagonist along the lines of McCain, Flake or Ben Sasse (R-Neb.).

“That’s not his style,” former Senate majority leader Trent Lott (R-Miss.) said when asked whether Kyl will be as fiercely outspoken as McCain and other Trump critics. “He sees things as they are and tries to make them better.”

That doesn’t mean that Kyl won’t have a stern word or two for Trump. Since he retired in 2013, the Arizona Republican has registered more concern about the president than most sitting Republican senators.

In a February interview with Phoenix-based radio station KJZZ, Kyl described Trump as a “phenomenon that has to be dealt with” and took aim at his combative manner. “I don’t like his style. Much of it is boorish. I think he’s his own worst enemy,” Kyl said of Trump, adding that he “could be much more effective if he were more politic, more diplomatic.”

In remarks last week at a memorial service for McCain at the Arizona State Capitol, Kyl also made what many interpreted as a swipe at Trump’s overly friendly relationship with Russian President Vladi­mir Putin.

“When others were looking into Vladimir Putin’s eyes, with an eye of understanding him and reaching accommodation with him, John, of course, said: I looked into his eyes and saw KGB,” Kyl said.

Kyl said Tuesday that he stood by his previous remarks about Trump, though he struck a somewhat softer tone.

“I think sometimes, his desire to jump into the middle of a fight or maybe even create a fight — by the way, that reminds me of somebody — but sometimes, that can be detrimental to what he’s trying to achieve,” Kyl said, in what appeared to be a veiled comparison to McCain.

He added that he doesn’t “really have a relationship with President Trump” and only met him once, several months ago. Still, he said he was honored to be supporting Kavanaugh’s nomination.

The governor informed Senate Majority Leader Mitch McConnell (R-Ky.) about his decision early last week, according to two other people familiar with the situation. Beyond that, Ducey and his allies held the choice very close in the days leading up to the public announcement.

It was only on Tuesday morning that they gave the White House a heads-up on the selection, according to one of the Republicans close to Ducey. And Ducey told Cindy McCain about his pick Tuesday morning. A White House spokesman did not immediately respond to a request for comment on when they learned of the choice.

Ducey made his selection primarily on the basis of Kyl’s reputation and ability to hit the ground running in the Senate, one of the people close to him said. But inside his orbit, there was also a recognition that he could appeal to a broad slice of what has become an increasingly divided Republican Party.

People describing the behind-the-scenes discussions spoke on the condition of anonymity to describe sensitive private conversations.

Kyl’s appointment to the Senate comes after he ruled out a return to Congress in his February interview with the Phoenix radio station.

“No,” Kyl said flatly when asked whether he might one day serve again. “And I don’t wish I was still there.”

Lott said he was surprised by his former colleague’s decision but that it was in keeping with his character.

“It’s typical of Jon,” Lott said. “He’s doing it for the cause.”