Rouhani UN
Iran's President Hassan Rohani addresses the United Nations General Assembly DON EMMERT/AFP/Getty Images

Iranian President Hassan Rohani told the UN that Tehran is committed to reaching a nuclear deal with the West within the next two months, and to play an active role in fighting extremists in the Middle East.

Addressing the UN General Assembly in New York, Rohani said that if Iran's counterparts showed determination and a degree of flexibility, an agreement was possible before the deadline of the P5+1 nuclear talks in November.

Tehran was however determined to meet its energy demand through a "peaceful" nuclear program, which included uranium enrichment, he said.

Rohani described the deal as a "historic opportunity" for the West that would represent a cornerstone for future cooperation "at regional and international levels, allowing for greater focus on some very important regional issues such as combating violence and extremism in the region."

The President tweeted:

Rohani also warned that Islamic State (IS) militants and al-Qaida were creating chaos in the Middle East, aiming toward the destruction of civilization, and encouraging the rise of Islamophobia. He tweeted:

Rohani described IS, previously known as Isis, as a "terrorist group" and said he was pained for its members "spill blood in the name of religion and behead in the name of Islam."

He tweeted:

Iran sent a Special Forces unit to help its ally Iraq counter IS's advance earlier this year. IS's Sunni hard-liners consider Shia muslims as heretics and therefore Iran as an enemy.