Mahmoud Ahmadinejad made the remarks on Tuesday to commemorate Army Day.
"Today, you are among the world's most powerful armies because you rely on God," Ahmadinejad told military officers before a parade of the armed forces in southern Tehran.
"Iran's enemies know your courage, faith and commitment to Islam, and the land of Iran has created a powerful army that can powerfully defend the political borders and the integrity of the Iranian nation and cut the hands of any aggressor and place the sign of disgrace on their forehead," he said.
Ahmadinejad said Iran's army "has to be constantly ready, equipped and powerful. It has to be equipped with the latest technologies, recognise the enemy and constantly be vigilant".
However, he said Iran's army would "serve peace and security for mankind especially the region and its neighbours".
"Power of our army will be no threat to any country. Our army carries the message of peace and security ... it is humble towards friends and a shooting star towards enemies," he said.
The president made the comments amid escalating tensions between Iran and Western nations over Tehran's suspected nuclear activities.
Ahmadinejad has engaged in a series of high-profile threatening statements since making the announcement last Tuesday that Iran had enriched uranium using 164 centrifuges, a significant step towards the large-scale production of a material that can be used to fuel nuclear reactors for generating electricity, or to build atomic bombs.
Iranian soldiers commemorating
Army Day in Tehran on Tuesday
Since that announcement, Ahmadinejad has been more defiant in defending Iran's decision to press ahead with its nuclear programme despite the UN Security Council's objections.
Ahmadinejad refused a request last week by Mohammed ElBaradei, the head of the International Atomic Energy Agency, that Iran suspend uranium enrichment
To those upset by that stance, he said, "Be angry at us and die of this anger."
Senior diplomats from six countries meet for dinner in Moscow on Tuesday to try to find a solution to the nuclear deadlock.
The Russian foreign ministry said on Monday that Moscow would insist on a diplomatic solution to the problem when diplomats from Russia, the US, China, Germany, France and Britain meet.
A Western diplomat said on customary condition of anonymity that discussions of the Iranian issue were to continue during a Wednesday meeting of envoys from the Group of Eight major industrialised nations.