Saudi Arabia used an attack on its embassy in Tehran as a pretext to fuel tensions, Iran's foreign ministry said on Monday after Riyadh severed diplomatic relations.
Iran was committed to protecting its foreign diplomatic missions, the ministry added.
Iranian protesters stormed the Saudi embassy in the early hours of Sunday after Saudi Arabia executed Shi'ite cleric Nimr al-Nimr, prompting Riyadh to withdraw its diplomatic staff and order Iranian diplomats to leave the kingdom.
The protesters lit fires and smashed furniture in the embassy before being cleared out by the police, who made 40 arrests. No Saudi diplomats were in the embassy. Iranian officials condemned the attack as well as Nimr's execution.
"Iran has acted in accordance with its (diplomatic) obligations to control the broad wave of popular emotion that arose," foreign ministry spokesman Hossein Jaberi Ansari said in televised remarks.
"Saudi Arabia benefits and thrives on prolonging tensions... (It) has used this incident as an excuse to fuel the tensions," he added.
Ansari said Iranian diplomats had not yet left Saudi Arabia. They were given 48 hours to leave late on Sunday night.
Saudi Arabia's position toward Iran is that "enough is enough," a source familiar with the Saudi government's thinking said on Sunday after protesters stormed the Saudi embassy in Tehran over the execution of a Shi'ite Muslim cleric and Riyadh cut diplomatic ties with Tehran.
The source, who spoke on condition of anonymity, suggested the Saudi government was upset not merely with Iran but also with the United States for a perceived failure to respond to what Riyadh sees as Tehran's interference throughout the region.
The United States and five other powers struck an agreement with Iran on July 14 by which Tehran agreed to curb its nuclear program in exchange for relief from economic sanctions. Some Gulf Arab officials fear Washington may neglect their interests in the service of implementing the nuclear deal.
Iranian protesters stormed the Saudi embassy in Tehran early on Sunday, a day after the kingdom said it executed 47 people for terrorism, including the prominent Shi'ite Muslim cleric Nimr al-Nimr.
The cleric's execution was condemned by Shi'ite-majority Iran and is the latest collision between the two regional rivals who in recent years have found themselves on opposite sides of conflicts everywhere from Syria and Yemen to Lebanon and Iraq.
Sunni-majority Saudi Arabia, one of the most religiously conservative countries in the world, largely follows the strict Wahhabi school of Sunni Islam. Traditional Wahhabi doctrine is ultra-conservative and views Shi'ites as heretical.
"Enough is enough. Again and again Tehran has thumbed their nose at the West. They continue to sponsor terrorism and launch ballistic missiles and no one is doing anything about it," said the source, who spoke on condition of anonymity.
"Every time the Iranians do something, the US backs off. In the meantime, Saudi (Arabia) is actually doing something about it in Syria, in Iran and in Yemen," the source added. "The Saudis really don't care if they anger the White House."
The source later said he had mischaracterized the Saudi position toward the White House, saying that Riyadh was not indifferent to the Obama administration's views but felt it had little choice but to defend its interests where necessary.
"It isn't that they don't care what the White House thinks," the source said. "Obviously the Saudis and the US need to work together on quite a few issues. But it's an instance in which the Saudis (feel they) need to forge ahead on their own in their own best interests in terms of dealing with Iran in the region."