Opposition to Israel is a touchstone of belief for Iran, which backs Palestinian and Lebanese Islamist militant groups opposed to peace with Isreal, which Tehran does not recognise.
"What has happened in Palestine in recent years annuls all plans for compromise with the Zionist enemy (Israel) because no plan for Palestine can be implemented in the absence or contrary to the opinions of its owners, the Palestinians," Khamenei said, speaking in Arabic and addressing Palestinians and other Arabs.
Thus, Khamenei said, all previous peace agreements -- such as the 1993 Oslo Accords, the two-state solution to resolve the Israeli-Palestinian conflict, and former U.S. President Donald Trump's plan dubbed the Deal of the Century "are null and void".
President Ebrahim Raisi, Iran’s military commanders and senior officials also attended the rallies in which people were allowed to march through the streets, the first time since the outbreak of the coronavirus pandemic two years ago.
Iran's Jerusalem Day rallies are held annually in support of Palestinians, who want East Jerusalem as the capital of a future state in territories captured by Israel in a 1967 war, on the last Friday of the Muslim fasting month of Ramadan.
"Stop your vicious deeds. You know well that we are people of action and reaction,” Revolutionary Guards commander Hossein Salami, addressing Israel, told demonstrators in Tehran.
"Our responses are painful. You create conditions for your own destruction. We will not leave you alone ...You know better than me what will befall you if you take evil action.”
Iran's military has vowed to retaliate harshly against any attack by Israel, which has often voiced concern over the Iranian nuclear programme. Tehran says the programme is for peaceful purposes only.
Israel, whose existence the Islamic Republic does not recognise, has long threatened military action against Iran if talks between Tehran and world powers fail to curb Iranian nuclear activity. Iran says its nuclear ambitions are peaceful.
In February, the Islamic Republic unveiled its "Kheibar Buster" missile with a range of 1,450 km (900 miles).
Iran, which has one of the biggest missile programmes in the Middle East, says its ballistic missiles have a range of up to 2,000 km (1,200 miles) and are capable of reaching its arch-foe Israel and U.S. bases in the region.
Kheibar refers to an ancient Jewish oasis in the Arabian Peninsula's Hijaz region that was overrun by Muslim warriors in the 7th century.
Tehran regards its ballistic missile programme as an important deterrent against the United States, Israel and other adversaries, and has rejected Western demands to halt it.
Over the past year, Iran and the United States have engaged in fitful, indirect talks in Vienna to revive a 2015 nuclear deal that then-President Donald Trump reneged on in 2018 and that Iran, in turn, began violating in 2019.
Under the 2015 deal, Iran agreed to limit its nuclear programme in return for relief from economic sanctions.
While they appeared close to resurrecting the deal in March, talks stalled over last-minute Russian demands and whether Washington might drop Iran's Revolutionary Guards from its Foreign Terrorist Organization list.