In their first visit together to Baghdad, Secretary of State Condoleezza Rice and Defense Secretary Donald H. Rumsfeld met with leaders of Iraq's emerging government as the top U.S. military commander said some American troops may be able to leave in the next few months.

The surprise visit by President Bush's top national security officials was a dramatic show of support for Jawad al-Maliki, the Shiite selected to be prime minister, in a development the United States hailed as evidence of substantial progress.

"I came away most encouraged," Rumsfeld said after a private meeting with al-Maliki. Rice offered praise as well, saying "I found him to be very focused. It's very clear that he understood his role and the role of the new government to really demonstrate that there's a government of national unity."

The meeting also occurred just after Army Gen. George Casey, the top U.S. military commander, said that the selection of top government leaders marked a major step toward creating conditions that could allow a partial withdrawal.

"I'm still on my general timeline," Casey told reporters after meeting with Rumsfeld, who arrived unannounced for a daylong series of meetings with top U.S. commanders and the newly selected Iraqi leaders.

Casey used no figures. There are about 130,000 U.S. troops in Iraq, and military officials have spoken before of their hopes of reducing that figure below 100,000 by the end of the year.

Rice told reporters, "We just want to make sure there are no seams between what we're doing politically and what we're doing militarily. Secretary Rumsfeld and I are going to be there together because a lot of the work that has to be done is at that juncture between political and military."

She and Rumsfeld huddled with U.S. Ambassador Zalmay Khalilzad and other top U.S. military and civilian officials for lunch, met with al-Maliki, at Khalilzad's house inside Baghdad's heavily guarded Green Zone.

Al-Maliki told Rice and Rumsfeld that his first priority is addressing mistrust among Iraq's ethnic factions and said success on that front will give a head start toward addressing security, terrorism, violence and corruption.

On the question of corruption he agreed with Rice and Rumsfeld that selecting strong, competent and nonsectarian leaders for key jobs will help Iraqis have confidence in the new government.

He said as a practical matter, one of the first things he wants to do is address a long-standing irritant for ordinary Iraqis: the poor quality or lack of electricity.

Rice scheduled a separate one-on-one meeting with al-Maliki later.

Casey did not elaborate on his timeline for reducing U.S. forces, but he has said in the past that a "fairly substantial" reduction could be made this year if the insurgency did not grow worse and if Iraq made continued progress on the political and security training fronts.

Asked whether the breakthrough agreements last weekend to name al-Maliki as prime minister and to fill six other top government posts moves U.S. officials closer to implementing the expected troop reductions this year, Casey replied, "It certainly is a major step in the process."

He added that more needs to be accomplished on the political side, particularly in filling key government ministry jobs.

The Pentagon has not said when it expects to make decisions about further troop reductions. Casey had said late last year that he expected to submit his recommendation this spring.

"We are seeing the situation a little clearer, I'd say," as a result of the latest political progress, Casey said. "And the clearer I see it the better I can make my recommendations."

Rumsfeld, who appeared with Casey before reporters, said one of the subjects they had discussed was engaging the emerging Iraqi government in talks on the future of military bases and the division of security responsibilities between American and Iraqi troops.

"There is no question but that as the new government is formed and the ministers are in place, that it's appropriate for us to begin discussions with the new government about the conditions on the ground and the pace at which we'll be able to turn over responsibility in the provinces," Rumsfeld said.

Rumsfeld said the United Nations Security Council resolution that forms the legal basis for U.S. operations to stabilize and rebuild Iraq is to expire at the end of the year so there will have to be talks with the Iraqi government on arrangements beyond this year.

Alluding to recent calls by several retired generals for Rumsfeld to resign, a reporter asked the 73-year-old defense secretary whether this visit — his 12th — would be his last trip to Iraq as Pentagon chief.

He replied with one word, and no smile: "No."

U.S. officials have made clear their concern that the emerging Iraqi government place a high priority on disarming or otherwise controlling armed militias that are accused of sectarian violence.

Lt. Gen. Peter Chiarelli, the second-ranking U.S. general in Iraq, said in an interview with a small group of reporters that militias are an urgent threat to the country's stability.

"That to me is an issue we've got to get fixed," Chiarelli said.

Casey had said last year that if the insurgency did not worsen and the Iraqis remained on track toward establishing a government of national unity, then fairly substantial reductions in the U.S. troop presence were likely this spring and summer. So far, the total has been reduced only slightly, from about 138,000 to about 132,500 and no further cuts have been announced.