"The plots by the United States and Israel to create division among the Iranians, Iraqis and the Lebanese were defeated," Hassan Rouhani said here, addressing a huge gathering in Tehran's Azadi (liberty) square to celebrate the 39th anniversary of the victory of the Islamic revolution.
"The Americans wanted to interfere in our internal affairs, but our people turned back to them," Rouhani said, alluding to the recent unrests in the cities of Iran over the economic hardship of people.
The Iranians in solidarity and unity aborted all the US plots and plans to disturb the country, he added.
Besides, the US plot to relocate its capital to Jerusalem (al-Quds) in Israel was faced with the international condemnation, he said.
Not only the Islamic states, but also overwhelming majority of other countries opposed the US plan in the general assembly meeting of the United Nations, he pointed out.
Moreover, Washington did not succeed in destroying the Iranian nuclear deal in several occasions, Rouhani said.
"I announce that the Iranian nation would remain committed to the nuclear deal as long as the other side respects it," Rouhani said, warning that in case the United States quit the nuclear deal, it would be "the loser."
Rouhani also hailed the achievements of 2015 nuclear deal for Iran, saying that it enabled the country to establish its nuclear rights internationally.
Despite the US pressures, the Islamic republic has also attracted billions of US dollars in foreign investments, the Iranian president stated.
"This is an indication of Iran's growth international reputation," he stressed.
No power in the world will be able to influence Iran in political, cultural and economic sectors, Rouhani said, lauding the country's "independence."
Amidst rising fresh tensions between the Islamic republic and the United States, hundreds of thousands of Iranians attended nationwide rallies on Sunday to celebrate the 39th anniversary of the victory of the Islamic revolution in 1979.
People in the Iranian cities swarmed to the streets carrying flags and banners in support of the Islamic establishment leaders and chanted anti-US, and anti-Israeli slogans.
The rallies in capital Tehran turned into a demonstration against the recent US sanctions and pressures on Iran over its ballistic missile program.
They also chanted slogans against some regional allies of the United States, including Saudi Arabia.
Earlier, Khamenei and Iran's President Hassan Rouhani called for mass turnout in the rallies to condemn the US recent threats against the Islamic republic.
Rouhani said people's "massive" attendance in the anniversary of the Islamic revolution would show solidarity and unity of the nation with the revolution and the leadership.
The 1979 revolution in Iran toppled the US-backed regime of Shah and brought the country under the leadership of Khomeini, an event seen as a turning point in Iran's history.
On Sunday, the statement at the end of the rallies called the United States as "the number one enemy of the Islamic republic."
The statement urged the Iranian officials to withstand the "excessive demands" of the United States and to resist its pressures and fresh sanctions.
Over the past year, the United States announced sanctions on multiple entities and individuals allegedly involved in Iran's ballistic missile program and providing support to the military in Iran.
In reaction, Iranian officials unanimously described the missile test as an "inalienable right" of the country to boost its deterrent power. Tehran has vowed to counter the fresh US sanctions.