"Our national power is for peace, we gain power for deterrence. Deterrence is the same as dignified peace. We should be ready to remove and thwart threats against the people," Rouhani said, addressing top military brass at a ceremony in Tehran.
Rouhani said Iran was ready to answer any possible questions but stressed that the country would not negotiate about its defense capabilities, Press TV reported.
"Our nation and authorities do not and will not need to negotiate with anyone or reach a deal with any power over their defensive capabilities," he said.
"If any authority comes and asks a question, we will give a firm and strong answer. Our answer is clear. But we will procure any weapon or capability which we need within the framework of rules and regulations and the fatwas of our Leader," he added.
Rouhani reiterated that the Islamic Republic is not after weapons of mass destruction according to a fatwa by Leader of the Islamic Revolution Ayatollah Seyyed Ali Khamenei.
Iran's defense capabilities have become the subject of US interest for fresh pressures on Tehran, especially the country's missile program.
On Monday, US Ambassador to the United Nations Nikki Haley said Washington was encouraging other UN Security Council countries to set aside the nuclear deal with Iran loathed by President Donald Trump and focus on cracking down on Iran’s missile program.
Rouhani further lent weight to Iran's defense industry, saying the country has to become strong enough so that no enemy dares to threaten it.
"We must be strong and powerful, because the Qur'an tells us that we must be so powerful to take away the courage from the enemy and those threatening us," he said.
"This means the enemy has either to be made disappointed about achieving a success or know that if it attacks us, it will have to pay immense costs," the president added.
Touching on the Iraqi-imposed war on Iran in the 1980s, Rouhani noted that the Iranian people and clerics stood up against an intruding army while neither the UN nor the regional states and friendly countries defended their land.
During the wartime, he said, Iranians put their trust in high-ranking military and political officials while world powers and reactionary regional countries supported the former Iraqi dictator Saddam Hussein.