Iran summoned the Afghan charge d'affaires on Tuesday after a violent protest at its diplomatic mission in western Afghanistan.
Tehran also announced the closure until further notice of its Afghan missions, where other protests had also occurred.
On Monday, dozens of Afghans chanting "Death to Iran" demonstrated outside the Iranian consulate in Herat after videos spread widely over the weekend, purportedly showing Iranians beating Afghan refugees.
Demonstrators burned an Iranian flag and damaged surveillance cameras at the mission before dispersing, an AFP correspondent said. They also threw stones at the compound.
On Monday, a similar anti-Iran protest occurred in the southeastern city of Khost, and another took place outside the Iranian embassy in Kabul.
Another demonstration against the videos occurred near Ahmad Shah Massoud Square in Kabul on Tuesday.
A statement on Iran's foreign ministry website said the embassy in Kabul had also been targeted.
The statement, issued Tuesday, said the ministry's director general for South Asia summoned Afghanistan's charge d'affaires in Tehran "to vigorously protest the attacks on the Iranian embassy in Kabul and the consulate general in Herat".
It added that the embassy and consular sections in Afghanistan had suspended operations "in order to obtain necessary assurances guaranteeing total security of the missions."
Iran, which hosts more than five million Afghan refugees, has seen a fresh influx of Afghans since the Taliban returned to power last August.
The protests occurred after the weekend circulation on social media of the videos claiming to show Iranian border guards and Iranian mobs beating Afghan refugees in Iran.
It was unclear when the images were filmed, and their authenticity could not be independently verified.
On Sunday, Iran's embassy in Kabul called the images "baseless and invalid".
Since the Taliban seized power, Afghanistan has plunged further into economic crisis, pushing even those without links to the former Western-backed government to scramble for an exit.
Thousands of people daily try to cross into neighboring Iran in search of work, or in a bid to reach Europe in the hope of asylum.
Iran has so far not recognized the Taliban government.