Fighters of the Islamic State of Iraq and the Syria (ISIS) celebrate on vehicles taken from Iraqi security forces, at a street in the city of Mosul, June 12, 2014. Reuters

The U.S. may be joining forces with an unlikely adversary -- Iran -- if President Barack Obama decides to use force in Iraq. And it’s an idea that Tehran is open to, according to a senior Iranian official.

“We can work with the Americans to end the insurgency in the Middle East,” the official told Reuters in a story published Friday. "We are very influential in Iraq, Syria and many other countries."

The possibility of Iran working with the U.S. to quell the insurgency has been discussed internally among high-ranking Iranian officials, the source said. But it was unclear if those talks reached anyone else, including the United States.

Iran sent two units of its elite Quds Forces into Iraq on Thursday to fight alongside Iraqi soldiers. The units are already making progress, helping the Iraqis reclaim most of Saddam Hussein’s hometown of Tikrit from the al Qaeda offshoot the Islamic State of Iraq and Syria, or ISIS.

Longtime foes, Iran and Iraq have had warmer relations as of late, as Iran’s population is largely Shiite Muslim and Iraq’s government also is from the same branch of Islam. ISIS adheres to Sunni Islam.

Although relations between Iran and the U.S. have somewhat improved since Iranian President Hassan Rouhani was elected in 2013, the countries are at odds over Iran’s nuclear program. But the U.S. and Iran have common ground when it comes to al Qaeda.

“Clearly, we’ve encouraged [the Iranians] in many cases to play a constructive role,” said U.S. State Department spokeswoman Jen Psaki on Thursday. “But I don’t have any other readouts or views from our end to portray here today.”

It’s still unclear what military action, if any, Washington will take in Iraq. Obama said Thursday, “I don’t rule anything out,” although White House spokesman Jay Carney later clarified that statement to say the U.S. is not considering ground troops in Iraq. Iraqi Prime Minister Nouri al-Maliki reportedly secretly requested airstrikes on insurgents but was rebuffed by Washington.

ISIS militants took control of Mosul, Iraq’s second-largest city, earlier this week.