TEHRAN, Iran -- Iran's top leader on Friday ruled out any formal cooperation with America against the Islamic State of Iraq and Syria, or ISIS, their common adversary in Iraq and Syria, insisting that the United States remains a prime enemy of Tehran, despite a landmark nuclear deal with word powers.

Trusting the U.S. would be "a big mistake," said Supreme Leader Ayatollah Ali Khamenei, insisting that cooperation with America goes "against the independence" of Iran.

There has been no formal talk of a joint fight or even cooperation between Iran and the United States against ISIS. Nevertheless, Khamenei's remarks were somewhat ironic since the war against ISIS has put Americans and Iranians in close proximity.

In Iraq, Iran's powerful Revolutionary Guards are on the ground, helping Shiite militiamen and Iraqi forces in their offensive on Fallujah, an ISIS stronghold west of Baghdad. A U.S.-led airstrike campaign is also backing that battle.

But Khamenei said that despite the nuclear deal which went into effect this year, Iran has "many small and big enemies, but foremost among them are America," Britain and Israel.

Get Breaking News Delivered to Your Inbox

He spoke at a ceremony marking the 27th anniversary of the death of Ayatollah Ruhollah Khomeini, the leader of the 1979 Islamic Revolution that brought hard-line clerics to power and ousted the U.S.-backed Shah Mohammad Reza Pahlavi.

Tens of thousands of Iranians attended the ceremony in Tehran while state TV broadcast Khamenei's 90-minute speech live.

The deal with world powers eased Tehran's isolation from the international community and removed many economic sanctions in exchange for Iran curtailing its nuclear program.

But the agreement, struck in 2015 with moderate President Hassan Rouhani's administration, has been assailed by Iranian hard-liners, and in the months since its implementation, Iran has conducted missile tests criticized by the U.S., as well as aired footage on state television of an underground missile base.

In Syria, Shiite power Iran is a top backer of President Bashar Assad, along with Russia. Tehran has deployed what it says are military advisers to support the Syrian government and has had casualties in the conflict, though it denies the presence of Iranian combat troops.

Meanwhile, the U.S. and its Western allies, along with most Gulf Arab nations, back the Syrian rebels fighting to topple Assad.