Ahmadinejad planned to undermine US Afghanistan campaign's legitimacy.