Breaking News Emails

Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Iran would be willing to overlook contentious relations with the United States and work together in providing assistance in Iraq — if Washington vows to fight "terrorist groups in Iraq and elsewhere," Iranian President Hassan Rouhani pledged Saturday.

Rouhani, appearing on state-run television, said that Iran is standing ready to help its next-door neighbor in the fight against the militant insurgency that broke out earlier this week. But so far, Iraq's Shiite-led government hasn't taken up Iran's offer.

Sign up for breaking news alerts from NBC News

Sunni forces have seized northern Iraqi towns and are threatening to take the nation's capital, Baghdad, amid fears of escalating sectarian violence. Iran is also led by Shiite Muslims.

"We all should practically and verbally confront terrorist groups," Rouhani said Saturday, referring to the Sunni insurgents known as the Islamic State of Iraq and al-Sham (ISIS), which continues to move south toward Baghdad.

"If we see America starts confronting the terrorist groups in Iraq or elsewhere," Iran will step in and work with Washington to help Iraqi Shiite troops protect their country, Rouhani said.

On Friday, President Barack Obama said he was reviewing options to help Iraq, but would avoid sending American soldiers back to Iraq. He added that help from the U.S. was contingent on the Iraqi government doing their part in securing peace between Shiite and Sunni factions.

U.S. officials told Reuters that Washington was not currently in contact with Iran concerning the crisis in Iraq.

Relations have remained strained between Washington and Tehran over Iran's nuclear activity.

Rouhani, a relative moderate who has worked to mitigate tensions with the West, said disputes over their nuclear program "can be resolved with goodwill and flexibility."

Past talks between negotiators from Iran, the United States, Britain, France, Germany, Russia and China — who will gather again starting Monday — aim to meet a July 20 deadline seeking to reach a deal with Iran over their nuclear activity.

The U.S. and Israel have communicated doubt that the deadline will be met because the amount of centrifuge enrichment machines that Iran wants to keep does not line up with what would be acceptable to the West.

Israel has threatened to bomb Iranian nuclear sites if they do not curb their nuclear activity.

Rouhani said if a deal cannot be met, discussions can continue for a month or more beyond the deadline, but warned that sanctions meant to restrict their nuclear activity have been rendered nearly useless.

"The West should use this opportunity to reach a final deal in the remaining weeks. American hawks and Israel will be blamed for failure of the talks," Rouhani said Saturday.

Reuters contributed to this report.