"I opposed this war from the beginning. I opposed the war in 2002. I opposed the war in 2003. I opposed it in 2004 and 2005 and 2006."
Barack Obama on Wednesday, September 12th, 2007 in Clinton, Iowa
Obama has consistently opposed the war
In other words, Obama's sweeping claim to have long opposed Iraq is true. Opponents have attacked Obama's record of opposition on two grounds. They argue that Obama should answer definitively how he would have voted if were in the Senate at the time of the vote. Obama said in 2004 he can't answer that question fully because he doesn't know what intelligence the senators had access to.
Opponents also have taken comments of his out of context to suggest he supported the war, particularly his 2004 statement that "There's not much of a difference between my position and George Bush's position at this stage." But that quote is pulled from a story in which Obama expresses a sentiment that now that the war has started, the U.S. should do the best job it can to steer Iraq toward stability.
Obama joined the U.S. Senate in 2005. He has voted several times to continue funding for the war, saying that troops in Iraq should be funded even if he disagreed with the overall war. (The measure passed 97 to zero.) In recent months, like other Democratic candidates, he has voted in favor of troop withdrawals and other measures to bring the war to a conclusion.