“We see this as an act of war,” the Saudi foreign minister, Adel al-Jubeir, said in an interview on CNN on Monday. “Iran cannot lob missiles at Saudi cities and towns and expect us not to take steps.”
Iranian commanders have denied any role in providing Houthi rebels with missiles.
The attack coincided with a surprise development in another country where the Saudis and the Iranians contend for influence: Lebanon. The Lebanese prime minister, Saad Hariri, announced his resignation on Saturday in a televised address from Riyadh, accusing Iran of “sowing fear and destruction” in the region and saying that he feared for his life.
Mr. Rouhani, in remarks to a cabinet meeting and posted on his official website, also attacked Saudi Arabia, saying it had forced out Mr. Hariri.
“In history we don’t know of an example that a country, in order to interfere with the affair of another country, would force the official of that country to resign,” Mr. Rouhani said.
A day after Mr. Hariri’s bizarre resignation came a wave of high-level arrests in Saudi Arabia that appeared to complete a consolidation of power by the 32-year-old Prince Mohammed.
No Iranian official has given a reaction to the arrests, but Mr. Rouhani appeared to refer to them briefly on Wednesday.
“If you are struggling with domestic problems inside Arabia, you should try to resolve them,” he said. “Why do you get others into trouble because of your own domestic problems and talk against all the nations of the region?”
Iran’s leaders are likely to be privately pleased at the arrests, Iranian analysts say, seeing the detentions as a purge with the potential to weaken their rivals.
Over all, Iran has been trying to avoid tensions with Saudi Arabia. It recently agreed to allow Switzerland to open an office to represent Saudi interests in Tehran, with the promise of establishing an Iranian-interest section in Riyadh.
On Wednesday, Mr. Rouhani called for dialogue. “I hope that new Saudi officials will stop their enmity with the regional nations and will chose the path of friendship,” he said. “They should know that respect for others will not do harm. They should know that Iran wants nothing but creating stability and security in the region.”