The U.S. military could remain in Iraq for years, but with the passage of time it should be able to step back into more of a supporting role for Iraqi security forces, the Pentagon's number two official said yesterday in a hearing notable for sharp partisan exchanges.

"I think it's entirely possible" that U.S. troops could be stationed in Iraq for years, Deputy Defense Secretary Paul D. Wolfowitz told the House Armed Services Committee. But, he added, as the Iraqi army and new national guard develop, "we will be able to let them be in the front lines and us be in a supporting position."

Wolfowitz said it is possible that U.S. troops could be used to enforce Iraqi martial law after the partial transfer of power a week from now. Ayad Alawi, Iraq's interim prime minister, has said martial law is possible to crack down on insurgents.

Helping impose martial law, Wolfowitz said, "might actually be something that we might mutually agree was necessary to bring order in a particularly difficult place."

But much of the hearing was devoted to a series of unusually pointed discussions between Wolfowitz and Rep. Ike Skelton, a centrist Missourian who is the committee's senior Democrat.

Skelton told Wolfowitz he senses two Iraqs: "One is the optimistic Iraq that you describe, and the other Iraq is the one that I see every morning, with the violence, the deaths of soldiers and Marines." He added, with some emotion: "I must tell you, it breaks my heart a little bit more every day."

Skelton also was dismissive of White House comments about "staying the course" in Iraq. "I don't think anyone here questions your resolve or questions the resolve of the president to succeed in Iraq," he said. "But there's a difference between the resolve on the one hand and competence on the other." He said he now fears that the United States is descending into "a security quagmire" in Iraq.

The two men went back and forth several times.

"From your description, Mr. Secretary, I don't see an end in sight," Skelton said. "We're stuck."

"We're not stuck, Mr. Skelton," Wolfowitz replied. He said that the U.S. strategy in Iraq clearly is to develop Iraqi forces that can take over security from U.S. and allied troops.

At another point, Skelton said he did not see a plan to bring about success in Iraq. He added, "We broke it -- we must do our best to fix it."

Wolfowitz shot back, "We didn't break Iraq. Saddam Hussein broke Iraq." The Pentagon official, just back from a four-day visit to Iraq, said, "It is going to be a big job to repair it, but I feel much more confident than before this trip, after spending many hours with the new prime minister and members of his government, that there is an Iraqi team ready to take charge on July 1st and committed to fixing that damage."

As the hearing went on, Wolfowitz sought to temper his initial presentation. "Maybe it's optimistic compared to the total gloom and doom that one otherwise hears, but I in no way mean to minimize the security problem," he said. "I agree with you, it is the obstacle to all the other progress that has been made." He said he is worried especially about the next six months, as insurgents seek to derail the Iraqi elections being planned for January 2005.

Wolfowitz also said the media are part of the problem in Iraq. "Frankly, part of our problem is a lot of the press are afraid to travel very much, so they sit in Baghdad and they publish rumors," he said.

Reporters in Iraq recently have restricted their movements, sometimes at the recommendation of U.S. officials, because of widespread violence.

Deputy Defense Secretary Paul D. Wolfowitz, left, and Joint Chiefs Vice Chairman Peter Pace testify.