"All three did what they needed to do: to demonstrate both command of the issues and their fundamental points," says Ivo Daalder, a senior fellow at the Brookings Institution who has advised the Obama campaign.

For Senator McCain, the presumptive Republican nominee, the key talking point was to claim victory for the "surge" of 30,000 troops into Iraq last year – a shift that he long had urged. He also asked tough questions about recent setbacks.

"We're no longer staring into the abyss of defeat and we can now look ahead to the genuine prospect of success," McCain said.

"Yet should the United States instead choose to withdraw from Iraq before adequate security is established, we will exchange for this victory a defeat that is terrible and long lasting," he added – a red flag to his Democratic rivals.

Ranking lower in seniority, Sens. Clinton and Obama waited hours Tuesday to respond to that shot across the bow, but respond they did.

In her most concise statement on the war to date, Clinton renewed her call for a "carefully planned withdrawal." She also pressed for guarantees that the Bush administration will not commit the US to long-term security agreements with Iraq that will bind the next president or leave Congress without a voice in the outcome.

When Clinton last faced General Petraeus and Ambassador Crocker in hearings on Sept. 11, 2007, she took a more combative tone. "Despite what I view as your rather extraordinary efforts in your testimony both yesterday and today, I think that the reports that you provide to us really require the willing suspension of disbelief," she said.

This week, she did not contest military gains on the ground but rather focused on unmet promises for political progress and the ongoing costs of the war, including resources diverted from Afghanistan and other challenges.

"Hillary got to produce her answer [to the war] with some clarity. It was the first piece of good news emerging about her and her campaign in two weeks," says pollster John Zogby.

For Obama, the only candidate on record opposing the decision to go into Iraq, the hearing also produced a change in tone. Seven months ago, Obama's main talking point was criticism of the Bush administration. "This continues to be a disastrous foreign-policy mistake. And we are now confronted with the question: How do we clean up the mess and make the best out of a situation in which there are no good options, there are bad options and worse options?" he said then.

But in a carefully calibrated line of questioning on Tuesday, Obama focused more on how to chart a way out, including opening a dialogue with Iran. "When you have finite resources, you've got to define your goals tightly and modestly," he said.

"I'm not suggesting that we yank all our troops out all the way. I'm trying to get to an endpoint," he said. But if the definition of success in Iraq is no traces of Al Qaeda, a highly effective Iraqi democracy, and no Iranian influence, "then that portends the possibility of us staying for 20 or 30 years," he said.

That reference was directed at McCain. In the run-up to hearings this week, House Democrats circulated talking points that included the claim that McCain anticipated keeping US forces in Iraq for 100 years. House Republican leader John Boehner dubbed the claim a "proven falsehood."

But McCain steered well clear of such long-range projections in comments and questions this week. In questioning Petraeus and Crocker, he focused on news reports that indicated that more than 1,000 Iraqi Army and police deserted or "underperformed" during recent operations in Basra.

"Suffice to say, it was a disappointment," he said. "And what are we going to do about it?"

"McCain's big risk on Iraq is not his position on the surge, because he's been so substantively vindicated. But when he talks about staying in Iraq 100 years or that it's all going swimmingly, that's when he gets into trouble," says Michael O'Hanlon, a senior fellow at the Brookings Institution who has advised Clinton.

But this week, McCain was "very effective in getting to the hard questions. It showed a workmanlike quality about him. He wasn't trying to make it all rosy or be triumphalist," he added. "Triumphalism doesn't fit the facts on the ground or the mood of the American people."