Iranian president Hassan Rouhani says his country is ready to help Iraq if asked, adding it has "no option but to confront terrorism".

Mr Rouhani said in a press conference that the Sunni militants who have seized cities in northern Iraq this week are linked to Iraqi politicians who lost in parliamentary elections in April.

Iran has built close political and economic ties with post-war Iraq, and many influential Iraqi Shiites have spent time in the Islamic Republic.

Tehran this week halted flights to Baghdad because of security concerns and said it was intensifying security on its borders.

Mr Rouhani said Iran will study any request for aid and is "ready to provide assistance within international law".

Iran is a close ally of the Shiite-led government in Baghdad.

Mr Rouhani said: "Entry of our forces (into Iraq) to carry out operations has not been raised so far. It's unlikely that such conditions will emerge."