Iranian President Hassan Rouhani Saturday offered to help the Iraqi government deal with Sunni insurgents seizing territory in a drive toward Baghdad.

Insurgents linked to the Islamic State of Iraq and Syria overtook Mosul, Iraq's second largest city earlier this week but Iraqi forces regained some territory north of Baghdad, Gen. Qassim Atta told a news conference Saturday.

In Tehran, Rouhani told a news conference if the Iraqi government "asks for our help, we will review [the request]," the Tehran Times reported.

"We, as the Islamic Republic of Iran, are both friends and neighbors of Iraq, and our ties with the Iraqi government are close and cordial," Rouhani said.

Earlier in the week, Rouhani told state television Iran would not tolerate terrorism.

"We fight against terrorism, violence and radicalism," Voice of America quoted him as saying.

Rouhani's offer came as the United States sent the aircraft carrier USS George H.W. Bush to the Persian Gulf to provide possible air support.

Iranians have taken to social media to express their concern about the situation in Iraq. One poster to VOA's Farsi Instagram account said, "We are not going to allow Sunni militants take over Shiite cities." A second poster said, "We shouldn't allow the dirty hands of extremist groups to reach (the Iraqi cities of) Karbala and Najaf."

A poster on Facebook said the insurgents' goal is to "plunder arms from Iraqi cities because it did not have the ability to fight long term. They will return to Syria with the spoils … to start a new round of conflict in Syria."