An attacker stabbed to death an Iranian cleric on Tuesday and wounded two, one of them seriously, in the shrine city of Mashhad, state media said.
The assailant and four suspected accomplices were arrested after the attack in the Imam Reza shrine's courtyard, said Mohammad Doroudi, chief prosecutor of the north-eastern city.
"The attacker is a foreign national," Mr Doroudi told the Fars news agency, without specifying the nationality.
Amateur video footage showed a man lying in a pool of blood in the courtyard.
"A man stabbed three Shiite clerics with knives, killing one and wounding two others," said the Governor of Khorasan Razavi province, Yaghoub Ali Nazari.
Fars released a picture of the three victims seated together in Mashhad, identifying them as Aslani, Pakdaman and Daraei. It did not say who was killed.
"Preliminary investigations show that the attacker committed this action under the influence of takfiri currents," Mr Nazari said.
The term "takfiri" is used to describe Muslims who take it on themselves to decide others are apostates and condemn them to death.
"With the vigilance of the pilgrims and the efforts of security forces, the assailant was immediately arrested and handed over to the police, and the injured were quickly taken to hospital," said the Astan Quds Razavi charitable foundation, which runs the shrine.
"The identity of the assailant is under investigation."
State news agency Irna broadcast mobile phone footage of the arrest of a suspect, in which people are seen pushing a young man in the courtyard.
People are heard shouting, "Don't beat him up," as some tried to prevent him from being attacked.
Iran has a population of 83 million, 90 per cent of whom are Shiite Muslims.