Concluding a visit to Venezuela on Saturday, Muhammad Khatami did not go into specifics about his country's nuclear programme, which his government insists is purely for peaceful energy use.
But his comments in the southeastern city of Ciudad Bolivar echoed a statement by Foreign Ministry spokesman Hamid Reza Asefi, who said neither threats nor incentives will alter Tehran's determination to develop peaceful nuclear technology.
"Each country that tries to do its will [or] be independent, is pressured militarily," Khatami said.
"We have to be strong to strike [back] against others for the aggression of other countries and to defend ourselves from the dangers of those who want to invade us," Khatami said, without elaborating.
The Iranian leader's comments came a day after the US government softened its stance on how to thwart Iran's nuclear programme, and agreed to support a European plan that offers economic incentives for Tehran to give up any weapons ambitions.
Hugo Chavez (R) says Iran has
the right to nuclear energy
US President George Bush's government insists Iran's uranium enrichment programme is aimed at developing a bomb, but Iranian officials have repeatedly denied it and said they are simply developing atomic energy.
"Now it is different than in the last century, when the great powers could have all [technology] exclusively," Khatami said.
"Maybe they think that our power depends on our military power ... maybe they think our power depends on sophisticated weapons and weapons of mass destruction," Khatami said.
However, he said, Iran's strength comes through seeking better technology to aid development.
Venezuelan President Hugo Chavez also defended Iran on Friday, saying the country has a right to nuclear energy.
About 2000 Chavez supporters marched through Caracas on Saturday protesting against what they said could be an attack by the United States against Venezuela.
The populist leader has repeatedly accused Bush's government of backing plots to oust him, but US officials have flatly denied it.
"We have to be strong to strike [back] against others for the aggression of other countries and to defend ourselves from the dangers of those who want to invade us"
Chavez has threatened to stop selling oil to the United States if it tries to "hurt" Venezuela. He has been critical of US actions across the world, including the war in Iraq.
While visiting Ciudad Bolivar with Khatami, Chavez accused the media of seeking to create "false ideas, like the one about Islamic fundamentalism".
"What can be more dangerous than Washington?" he said.