U.S. Secretary of State John Kerry says the U.S. is open to cooperating with Iran in order to resolve the deteriorating security situation in Iraq.

In an interview on Monday with Yahoo News, Kerry said the Obama administration is “open to discussions” and and would “not rule out anything constructive.”

Kerry was quoted as saying: “We're open to discussions if there is something constructive that can be contributed by Iran, if Iran is prepared to do something that is going to respect the integrity and sovereignty of Iraq and the ability of the government to reform.”

Last week, the Daesh Sunni militant group took over Iraq’s second-largest city, Mosul, and it has been posting graphic photos of its gunmen killing scores of captured Iraqi soldiers.

The Iranian president’s latest speech has left some doors open regarding collaboration with the U.S. in Iraq, today Mohammad Javad Zarif Iranian foreign minister confirmed that Iraq has been cursorily discussed in view of its current unrest.