The Obama administration signaled that talks with Iran on countering insurgents in Iraq may begin this week amid renewed negotiations with Tehran and other world powers over trying to reach a long-term agreement to curb its nuclear program.

The U.S. and Iran separately have agreed to help Iraq's Prime Minister Nouri al-Maliki battle a fierce al Qaeda-inspired insurgency by Islamic State of Iraq and Syria, which has taken control of major cities in the northwest and is threatening Baghdad.

Secretary of State John Kerry, in an interview with Yahoo News on Monday, said the U.S. would be open to cooperating with Iran militarily on how best to repel the ISIS offensive.

“This is a challenge to the stability of the region,” he said. “It is obviously an existential challenge to Iraq itself. This is a terrorist group,” he told Yahoo News Global Anchor Katie Couric in an interview.

Pressed further on how the two longtime foes would cooperate, Kerry said: “Let's see what Iran might or might not be willing to do before we start making pronouncements.”

“I think we are open to any constructive process here that could minimize the violence, hold Iraq together, the integrity of the country and eliminate the presence of outside terrorist forces that are ripping it apart,” he continued.

"I wouldn’t rule out anything that would be constructive to providing real stability, a respect for the [Iraqi] constitution, a respect for the election process, and a respect for the Iraqi people to form a government that represents all of the interests of Iraq — not one sectarian group over another," he said.

The comments come as President Obama continues to weigh his options in Iraq, including possible air strikes to beat back ISIS and prevent the terrorist group from taking Baghdad and further plunging the country into civil war.

Last week, the fighters took control of of two northern cities: Mosul, the country's second-largest city, and Tikrit, Saddam Hussein's hometown. Overnight, ISIS seized the city of Tal Afar.

Over the weekend, Kerry said Obama was carefully considering his options, including airstrikes, and underscored that the U.S. is deeply committed to the “integrity of Iraq as a country.”

U.S. State Department and Iranian officials, along with counterparts from Germany, the United Kingdom, France, Russia and China, will hold talks in Vienna this week aimed at securing a long-term deal to prevent Tehran from weaponizing its nuclear program by July 20.

The Vienna negotiations are focused solely on Iran's nuclear program, but a senior administration official told reporters early Monday that “some conversations” with the Iranians on Iraq may take place “on the margins.”

Any combined strategy would be complicated by U.S. demands that al-Maliki make political reforms in his Shiite-controlled government and take steps to include Sunnis in the political process and elevate their role in the military.

Iran, a majority Shiite country, is Maliki's closest ally in the region, and its Islamic Revolutionary Guards Corps has operated across the border throughout the Iraq war and maintains alliances with Shiite militias that have joined the Iraqi army in fighting ISIS this week in clashes north of Baghdad.