TEHRAN - Iran's President Hassan Rouhani on Sunday said that Muslim countries should strive to improve the world's opinion of Islam.

"We must remove Islam's negative image from today's cyber and real space," he said in Tehran at an international conference on "The Islamic World's Current Crisis". Most "violence, terror and massacres, unfortunately, take place in the Islamic world," he said.

"I invite all Islamic countries in this region and beyond - even those who until today have bombed and launched missiles on their neighbours - for all of us to stop this and choose the right path," he said.

He did not give any country names. "How many bombs and missiles have you purchased from America this year?" he asked. "If you had distributed the money for those bombs and missiles among poor Muslims, nobody would be going to bed hungry."

Tehran also backs the Syrian regime, whose army is fighting rebels and militants, including the Islamic State group that has taken over large swathes of the country and neighbouring Iraq. "If some groups like Daesh can recruit soldiers, the reason is financial and cultural poverty," Rouhani said, using an Arabic acronym for IS.

Both types of poverty should be eliminated from "Islamic society", he said. "Terrorism will not be destroyed by bombs." "For years and years, we have talked of unity. Is unity possible without economic connections within the Islamic world," he asked. The Syria and Iraq conflicts only benefit Israel and "those who are against Muslims", he said. His remarks were rare for a leader of Iran, which considers itself an authority in the Islamic world and often blames the "enemies" of the religion for problems in the Middle East.

"Did we ever think that, instead of enemies, an albeit small group from within the Islamic world using the language of Islam, would present it as the religion of killing, violence, whips, extortion and injustice?" Rouhani said.

Rouhani, a relative moderate, said Islamic principles opposed violence and the extremism of groups such as Islamic State stemmed from "narrow-mindedness and a lack of moderation".

Rouhani criticised Muslim countries for "being silent in the face of all the killing and bloodshed" in Syria, Iraq and Yemen - conflicts in which Iran plays a role.

Iran supports the government of Syrian President Bashar al-Assad, has close ties with neighbouring Iraq, and condemns the Islamic State group which fights both governments.

The Islamic Republic is also an ally of the Houthi movement which seized control of most of Yemen last year and has fought a military coalition led by Saudi Arabia for nine months.