From his website on the issues about the war in Iraq "John McCain believes it is strategically and morally essential for the United States to support the Government of Iraq to become capable of governing itself and safeguarding its people. He strongly disagrees with those who advocate withdrawing American troops before that has occurred."
"It would be a grave mistake to leave before Al Qaeda in Iraq is defeated and before a competent, trained, and capable Iraqi security force is in place and operating effectively. We must help the Government of Iraq battle those who provoke sectarian tensions and promote a civil war that could destabilize the Middle East. Iraq must not become a failed state, a haven for terrorists, or a pawn of Iran. These likely consequences of America's failure in Iraq almost certainly would either require us to return or draw us into a wider and far costlier war."
"The best way to secure long-term peace and security is to establish a stable, prosperous, and democratic state in Iraq that poses no threat to its neighbors and contributes to the defeat of terrorists. When Iraqi forces can safeguard their own country, American troops can return home."
John McCain said himself, "I do not want to keep our troops in Iraq a minute longer than necessary to secure our interests there. Our goal is an Iraq that can stand on its own as a democratic ally and a responsible force for peace in its neighborhood. Our goal is an Iraq that no longer needs American troops. And I believe we can achieve that goal, perhaps sooner than many imagine. But I do not believe that anyone should make promises as a candidate for President that they cannot keep if elected. To promise a withdrawal of our forces from Iraq, regardless of the calamitous consequences to the Iraqi people, our most vital interests, and the future of the Middle East, is the height of irresponsibility. It is a failure of leadership."
"I know the pain war causes. I understand the frustration caused by our mistakes in this war. And I regret sincerely the additional sacrifices imposed on the brave Americans who defend us. But I also know the toll a lost war takes on an army and on our country's security. By giving General Petraeus and the men and women he has the honor to command the time and support necessary to succeed in Iraq we have before us a hard road. But it is the right road. It is necessary and just. Those who disregard the unmistakable progress we have made in the last year and the terrible consequences that would ensue were we to abandon our responsibilities in Iraq have chosen another road. It may appear to be the easier course of action, but it is a much more reckless one, and it does them no credit even if it gives them an advantage in the next election.”