In rare criticism of the elite Revolutionary Guards, Rouhani slammed the decision to write anti-Israel messages on ballistic missiles before testing them.
"We saw how they wrote slogans on missiles and showed underground (missile) cities to disrupt the JCPOA (nuclear deal)," he said during the debate, which comes ahead of the May 19 election.
"Our nation got through these issues because the majority of society chose morality and Islam from day one," he added.
Rouhani said his conservative opponents in the election were linked to those trying to scupper the deal and broader outreach to the West.
Also Read
"When our diplomats were negotiating the deal, what were you doing behind the scenes? Some people acted like the opponents of the Iranian people," he said.
One of his main challengers, hardline cleric Ebrahim Raisi, said he would not tear up the nuclear accord but slammed what he called the government's weak stance and empty promises.
"This agreement was like a cheque that the government has been unable to cash. Mr Rouhani promised that after the signing of the deal all the sanctions would be lifted and people's lives would improve, but they have not," he said.
Rouhani hit back with a spirited defence of the nuclear deal, saying it had allowed a massive increase in oil sales and opened the way for Iran to take a central position in regional diplomacy.
Rouhani also vowed to improve civil rights -- a crucial plank of his 2013 presidential campaign which has been stymied by the conservative judiciary and security forces.
"Civil rights are not just on paper, they will turn into practice. We will hold different sectors responsible," he said.
The other main hardline challenger, Tehran mayor Mohammed Bagher Ghalibaf, sought to score points on the stagnant economy, seen as Rouhani's main weakness.
Ghalibaf returned frequently to his favourite theme -- attacking the elite "four-percenters", a nod to the global "We are the 99-per cent" campaign.
Six candidates were selected last month by the conservative-controlled Guardian Council, which rejected more than 1,600 applicants.
Split evenly between three conservatives and three moderate-reformists, the debates have the flavour of a team event.
Many expect the other moderate candidates -- vice- president Eshaq Jahangiri and Mostafa Hashemitaba -- to withdraw at the last minute to boost Rouhani's chances.
Disclaimer: No Business Standard Journalist was involved in creation of this content