(CNN) -- The Democratic presidential candidates offered a sharply different take on the Iraq war from that of GOP Sen. John McCain as each candidate observed the war's fifth anniversary Wednesday.

Sen. Hillary Clinton said Wednesday that she would bring U.S. troops home from Iraq if elected president.

"This war has now lasted longer than World War I, World War II or the Civil War," Sen. Barack Obama said in Fayetteville, North Carolina.

"Nearly 4,000 Americans have given their lives. Thousands more have been wounded. Even under the best-case scenario, this war will cost American taxpayers well over a trillion dollars," he added. "And where are we for all this sacrifice? We are less able to shape events abroad."

Obama also used the war's anniversary to question the judgment of Democratic nomination rival Sen. Hillary Clinton and that of presumptive Republican presidential nominee McCain.

"Since before this war in Iraq began, I have made different judgments. I have a different vision, and I will offer a clean break from the failed policies and politics of the past. Nowhere is that break more badly needed than in Iraq," he said.

In a speech in Detroit, Michigan, Clinton also said she would begin a troop withdrawal from Iraq if she became president.

"The soldiers from across this great state need a commander in chief who will end the war in Iraq and bring them home," she said.

Clinton later insisted during a campaign rally in Charleston, West Virginia, that a continued U.S. presence in Iraq would not help bring about a political agreement between the country's warring factions.

Don't Miss

"So we will start bringing them home, and we will tell Iraqis the ball is in their court," she continued. "Now, we will help them, we will support them, but we will not protect them if they refuse to do what we want them to do."

"America and our allies stand on the precipice of winning a major victory against radical Islamic extremism. ... Important political gains have also been made, but far more must be done in coming months to cement the gains made in huge cost in American blood and treasure," McCain said.

"Americans know that the consequences of failure would leave our nation less secure for generations to come," he said.

McCain was in Israel on Wednesday to meet with Prime Minister Ehud Olmert and former Prime Minister Benjamin Netanyahu. Earlier, McCain had traveled to Iraq and Amman, Jordan, as a part of a congressional delegation.E-mail to a friend