He met with Iranian President Mahmoud Ahmadinejad for wide-ranging talks on relations and the fight against terrorism .