Marine Gen. James E. Cartwright, who was a front-runner to be the next chairman of the Joint Chiefs of Staff, was told by President Obama over the weekend that he is no longer being considered for the position, U.S. officials said Tuesday.

The president could announce a replacement for Adm. Mike Mullen, who is in the final months of a four-year assignment as chairman, as soon as next week, the officials said, speaking on the condition of anonymity to talk about internal administration discussions.

It is not clear whom Obama will select to be his top military adviser, but two Army generals with extensive combat experience in Iraq are said to be under consideration: Gen. Martin E. Dempsey, who recently began a tour as Army chief of staff, and Gen. Raymond Odierno, who served as the top U.S. commander in Iraq and is overseeing the closure of the U.S. Joint Forces Command.

That Dempsey is being considered for the chairman’s job just weeks after he was sworn in to a different post suggests that the process of choosing the next chairman has hit an unexpected snag. White House and Pentagon spokesmen declined to comment Tuesday on the upcoming personnel moves.

Adm. James G. Stavridis, the commander of U.S. forces in Europe, was long thought to be a top contender for the chairman’s job or chief of naval operations. But U.S. officials said he has fallen out of the running in recent weeks.

Joint Chiefs Vice Chairman Gen. James Cartwright, right, talks to the media with Defense Secretary Robert Gates in April. (Alex Brandon/AP)

Cartwright had earned Obama’s trust during the difficult debates over how many additional troops should be sent to Afghanistan in 2009. But although he had forged a close relationship with the White House during his tenure as vice chairman of the Joint Chiefs of Staff, Cartwright was viewed with some suspicion by many of his fellow generals in the Pentagon, who said he wasn’t a team player.

In 2009, Cartwright worked quietly with Vice President Biden’s office on a plan that would have added about 20,000 troops to Afghanistan. At the time, top military commanders were pushing for as many as 40,000 soldiers and Marines.

Some senior officers in the Pentagon viewed Cartwright’s efforts to limit the troop surge in Afghanistan as undermining the military’s efforts to execute a robust counterinsurgency strategy in the restive southern and eastern portions of the country. White House officials, by contrast, argued that Cartwright’s efforts were critical to giving the president a broader range of options in Afghanistan.

After it became clear that Cartwright was being considered to succeed Mullen, his detractors in Washington initiated a whisper campaign that focused on his personal life in an effort to scuttle his chances.

In February, the Pentagon inspector general cleared Cartwright of allegations that he had a sexual relationship with a subordinate officer. Investigators found no evidence of a romantic relationship, but they did criticize the general for not disciplining the woman, who had passed out on a bench in his hotel room after drinking too much on a business trip.

It is unclear whether the largely unproven allegations against Cartwright played a role in the move to bypass him for the military’s top job.

It is also possible that Cartwright’s mixed relationship with some of his fellow generals in the Pentagon may have led the White House to have second thoughts about whether he could serve effectively in the Pentagon as chairman.

The next chairman will almost certainly preside over difficult reductions in the overall size of the armed forces and cuts in some of the military’s biggest weapons programs. The effort will require a chairman who can effectively build a consensus around tough and unpopular choices.

The departure this summer of Defense Secretary Robert M. Gates, who has been a popular leader among the top brass and has a deep reservoir of support in Congress, probably will further complicate efforts to shrink the defense budget and put added pressure on the next chairman.

In late April, CIA Director Leon Panetta was named to replace Gates.