In his interview with Larry King last week, Obama criticized John McCain for conflating al Qaeda and Iran:
He then went on to correctly identify Iran's relationship with Hamas:
[Y]ou heard, I think, the other day, Senator McCain confuse al Qaeda with Shia radical militias inside of Iraq. The president makes the same error. He keeps on conflating al Qaeda with all that's going on inside of Iraq. In fact, Iraq is a majority Shia country that is violently opposed to al Qaeda.
[I]'ve talked about the need for direct diplomacy with countries like Iran to get them to stand down on nuclear weapons and stop the kinds of rhetoric against Israel and the funding of Hezbollah and Hamas.
There's no doubt that, increasingly, Iraqis (Sunni and Shi'ite) are turning against al Qaeda. But if Iran is willing to cooperate with and fund Hamas, a majority Sunni organization, why is it impossible to imagine Iranian agents also backing al Qaeda? The Iranians certainly have an interest in promoting instability in Iraq, and funding al Qaeda could be one way to accomplish this.
That's not to say that Iran necessarily is sponsoring al Qaeda, but it's pretty silly so suggest, as many have, that there's no way the Iranians would put practical concerns ahead of sectarian ideology.
Anyway, this sounds to me like a gaffe on Obama's part.