WASHINGTON (AP) — Barely a week after winning re-election, President Barack Obama suddenly confronts a deepening challenge in assembling a new national security team, his task complicated by a scandal that has cost him a CIA chief and raised doubts about his Afghanistan war commander.

Hard questions from Congress, potentially bitter confirmation hearings and a scandal of infidelity and inappropriate emails are suddenly shaping the fight ahead. The White House portrayed a president focused on the economy and confident in his military and intelligence leadership, but clearly not thrilled.

When asked if the personnel troubles were an unwelcome distraction, presidential spokesman Jay Carney said: "I certainly wouldn't call it welcome."

Obama was already expecting to have to replace his chief diplomat, Secretary of State Hillary Rodham Clinton, and perhaps his defense secretary, Leon Panetta. Those two alone — plus Treasury Secretary Timothy Geithner, who is also leaving — help shape Obama's thinking and represent him before the world.

Now Obama is without his CIA director, David Petraeus, the once acclaimed military general in Iraq and Afghanistan who resigned in disgrace last week over an extramarital affair.

The details of that scandal keep expanding Tuesday, including the revelation that the top U.S. commander in Afghanistan, Gen. John Allen, is under investigation by the Pentagon for potentially inappropriate communications with another woman in the case. That, in turn, has frozen Allen's nomination to be the next commander of U.S. European Command and the commander of NATO forces in Europe, which casts more doubt about a military leadership in which each move affects another.

"It's a hard moment for the administration," said Joshua Rovner, an associate professor of strategy and policy at the U.S. Naval War College in Rhode Island. "It certainly wasn't expected, but if anything good comes out of it, they do have a chance to take a long, hard look at strategy."

Story continues

He noted that Petraeus had taken on such revered status for his military career that he won confirmation as CIA chief with little scrutiny.

Even beyond the surprise difficulties, Obama could have trouble with the rest of his high-stakes turnover.

When Clinton leaves, a favorite to replace her is Susan Rice, an Obama loyalist who serves as U.S. ambassador to the United Nations. She could face a bruising confirmation hearing given that she was the first face of the administration's maligned explanation of the fatal attack on the U.S. consulate in Benghazi, Libya.

"She's clearly going to have a little more difficult time than she would have if she hadn't gone out on all those talk shows," said Sen. Jon Kyl, R-Ariz., the second-ranking Senate Republican. Kyl is retiring at year's end and likely would not get a vote on Rice, but he said: "As of right now, I wouldn't support her."

Sen. Marco Rubio, R-Fla., said Rice could have a difficult time winning confirmation, although he didn't take a position.

"I'm concerned about the fact that she went on Sunday shows and said it was the product of a spontaneous uprising as opposed to a terrorist attack. Why did they wait so long to publicly ...change their position on it? I think she'd have to answer questions about that, no doubt about it."

Some of Rice's key advocates predict Republican lawmakers would not have the inclination or the votes to try to block Obama from appointing the State Department chief he wants. Yet others expect her confirmation hearing to be contentious and are wary of picking that fight at the start of the second term.

The other top candidate for the State job is Sen. John Kerry of Massachusetts, who is expected to be confirmed easily by his chamber colleagues. His departure from the Senate, though, could potentially cost Obama's party a seat by creating an opening for the man who just lost the other Senate seat, Scott Brown.

The idea of Kerry as defense secretary, which has also been floated, is not one that he has expressed an interest in, according to people close to him.

For Obama, the post-election period was intended to focus on starting to enact the economic agenda at the core of his re-election bid. He and Congress are in the hunt for elusive compromise before Jan. 1 if they are to avoid a huge package of tax increases and spending cuts that could derail the economic recovery.

Obama is, in fact, pursuing that course. But a story involving sex, resignations, national security and congressional oversight has a way of grabbing attention.

Carney, the president's spokesman, characterized the cases of Petraeus and Allen as individual matters that reflected no broader theme or challenge.

"I really would ask you to not extrapolate broadly," Carney told reporters. "The president has great confidence in the military, great confidence in his commanders, and will continue to have that confidence."

That expression of confidence extends to Allen, which is significant given the state of America's longest war. Allen is due soon to give Panetta a recommendation on the pace of U.S. troop withdrawals in 2013; about 68,000 U.S. troops are still serving in a war that is on pace to continue until the end of 2014.

How long Panetta himself will lead the defense agency is yet another unknown for Obama. The Pentagon chief Panetta recently has indicated a willingness to stay on for at least some of Obama's second-term.

When asked whether he would rule out staying for all of Obama's second term, Panetta said: "Who the hell knows?"

__

Associated Press writers Donna Cassata, Julie Pace and Bradley Klapper contributed to this story.

__

Follow Ben Feller at www.twitter.com/BenFellerDC