When Senate Republicans led by Obama’s 2008 opponent, John McCain of Arizona, and Lindsey Graham of South Carolina, declared their opposition to Rice’s possible appointment as the nation’s chief diplomat, the president became personally offended.

The famously cool former constitutional law professor took the most undiplomatic tack by singling out McCain and Graham for criticism, saying their complaints that Rice had misled them about the reasons for the Sept. 11 attack on the US consulate in Benghazi, Libya, were unjustified and misplaced.

“I don’t think there’s any debate in this country that when you have four Americans killed, that’s a problem,” Obama said in the majesty of the White House East Room. “And we’ve got to get to the bottom of it, and there needs to be accountability. We’ve got to bring those who carried it out to justice - they won’t get any debate from me on that.

“But when they go after the UN ambassador, apparently because they think she’s an easy target, then they’ve got a problem with me,” the president added.

In the ensuing weeks, Rice tried to save her nomination by traveling to Capitol Hill to meet face-to-face with McCain, Graham, and other opponents, including Senator Susan Collins of Maine.

But with each successive session, there were two trendlines: declining support for Rice and increasing backing for Kerry as an alternate nominee.

The Massachusetts Democrat is a Navy veteran of the Vietnam War, chairman of the Senate Foreign Relations Committee, and has been an unofficial administration emissary to world hotspots from the Horn of Africa to Pakistan.

“I think John Kerry would be an excellent appointment and would be easily confirmed by his colleagues,” Collins said during a morning television show appearance on Nov. 28.

Still, the president was unbowed.

“Susan Rice is extraordinary,” Obama told reporters when asked about his UN ambassador later that day. “I couldn’t be prouder of the job she’s done.”

In recent weeks, however, additional questions cropped up on subjects as diverse as Rice’s relationships in Africa and her investments related to the Keystone Pipeline.

All of them could have addressed in a confirmation hearing, but each successively raised the ante on Obama as he was immersed in sensitive “fiscal cliff” negotiations with congressional Republicans and even members of his own Democratic caucus.

Kerry kept his mouth shut, but it became apparent that his nomination would offer a path of lesser resistance. In a letter to Obama today, Rice kicked off the diplomatic two-step of living to fight another day.

“If nominated, I am now convinced that the confirmation process would be lengthy, disruptive and costly – to you and to our most pressing national and international priorities,” Rice wrote. “That trade-off is simply not worth it to our country. ... Therefore, I respectfully request that you no longer consider my candidacy at this time.”

She added: “The position of secretary of state should never be politicized.”

In a statement released just moments after Rice’s, the president played his part by offering his gratitude.

“I am grateful that Susan will continue to serve as our ambassador at the United Nations and a key member of my Cabinet and national security team,” the president said. “While I deeply regret the unfair and misleading attacks on Susan Rice in recent weeks, her decision demonstrates the strength of her character, and an admirable commitment to rise above the politics of the moment to put our national interests first.”

In a statement less than 90 minutes later, Kerry offered his own praise - and empathy.

“I’ve defended her publicly and wouldn’t hesitate to do so again because I know her character and I know her commitment. She’s an extraordinarily capable and dedicated public servant. Today’s announcement doesn’t change any of that,” he said.

Then, the failed 2004 Democratic presidential nominee added: “As someone who has weathered my share of political attacks and understands on a personal level just how difficult politics can be, I’ve felt for her throughout these last difficult weeks, but I also know that she will continue to serve with great passion and distinction.”

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.