Ayatollah Khamenei praised Iran's armed forces in a virtual address to a ceremony held for graduates of military academies in Tehran Sunday, calling them "a defensive shield in the true sense of the word against the hard threats of the external and internal enemies".
His remarks came after Iran's Army held military exercises on its northwestern border, with Foreign Minister Hossein Amir-Abdollahian stating that Tehran "does not tolerate the Zionist regime's activity against its national security", referring to Israel's relations with neighboring Azerbaijan.
"The interference of foreigners in the region is a source of discord and damage. All issues and incidents must be resolved without foreign interference and the countries of the region should follow the example of Iran and the armed forces of the Islamic Republic for power and rationality," the Leader said.
Ayatollah Khamenei said regional armies can provide security in the region, adding some states should not allow foreign armies to intervene or have a military presence in the region to protect their own interests.
"The events that are taking place in the northwest of Iran in some neighboring countries should be resolved with the same logic of avoiding giving permission to the presence of foreigners," the Leader said.
"The armed forces of our dear country always act with power combined with rationality, and this rationality should be a model for other countries and a factor in solving the existing problems, and everyone should know that whoever digs a pit for his brothers shall fall therein first," he added.
Ayatollah Khamenei described security as the "basic infrastructure of all necessary activities" for Iran's development, saying it is important to achieve security without relying on foreigners.
The Leader said while security is something normal for the Iranian nation, many countries - even in Europe - have a problem to achieve it, citing a recent spat between France and an emerging Anglo alliance over building submarines after Australia cancelled apparently under US pressure a $56 billion contract with Paris and awarded it to American and British companies.
"Some Europeans called the US action a stab in the back and in a way said that Europe should ensure its security independently without relying on NATO and in fact on America," he said, referring to French Foreign Minister Jean-Yves Le Drian's remarks in an interview.
"When European countries feel having a deficiency in achieving lasting security because of their reliance on the United States, which is not opposed to Europe, the comeuppance of other countries that have placed their armed forces under the control of the United States and other foreigners is clear," the Leader said.
To provide security by relying on foreign powers is just an "illusion", Ayatollah Khamenei said.
"Those who suffer from this illusion will soon get slapped because the direct or indirect interference of foreigners in the security, war and peace of any country is a catastrophic disaster."
Ayatollah Khamenei touched on the disgraceful withdrawal of well-armed US troops from Afghanistan in August, saying it was an example in pretension of power which proved hollow.
"Those Hollywood images of the US military and countries like it are just a show because their true nature is what was seen in Afghanistan," the Leader said.
"The Americans launched a military campaign against Afghanistan 20 years ago to overthrow the Taliban and during this long occupation, they committed many massacres and atrocities and caused great damage, but after all the material and human costs, they handed over the government to the Taliban and withdraw - a fact that is a lesson for all countries."
Ayatollah Khamenei also touched on the hatred of the East Asian people for the US military, saying "the Americans are hated by nations wherever they intervene".