DUBAI: A gunman opened fire at Azerbaijan's embassy in Iran killing its security chief and wounding two people, police said on Friday, in an attack Baku has called an "act of terrorism".
"The attacker broke through the guard post, killing the head of security with a Kalashnikov assault rifle," Azerbaijan's foreign ministry said.
Video posted on social media appeared to show a gunman run past a guard post and force his way into the embassy building, firing through a door.
Iranian foreign ministry spokesperson Nasser Kanaani "strongly condemned" the attack, according to state TV, saying the issue was under investigation.
Police in Tehran said they had arrested a suspect and are investigating the gunman's motive.
The superintendent of criminal affairs in Tehran, Judge Mohammad Shahriari, said the attacker's motive was personal, according to the Tasnim news agency.
He quotes the assailant as saying his wife went to the Azerbaijan embassy in Tehran and never returned home.
When the assailant contacted the embassy he never got an answer and believed his wife was inside the embassy. Iran's police chief said on television that the man's wife is from Azerbaijan.
Azerbaijan's President Ilham Aliyev said on Friday that the attack was "an act of terrorism" and demanded swift punishment.
"I firmly condemn the act of terrorism carried out at the embassy of Azerbaijan in Tehran," Aliyev said on Twitter.
Azerbaijan's foreign ministry said an "anti-Azerbaijani campaign" in Iran had contributed to the attack.
In a strongly worded statement, the Azeri ministry also accused Iran of long ignoring Baku's calls to bolster security at its embassy in Tehran.
"Unfortunately, the latest bloody terrorist act demonstrates the serious consequences of the failure to give the necessary attention to our constant appeals in this regard," it said.
Azerbaijan,a secular Muslim former Soviet republic which borders Iran, has friendly ties with the United States and Israel and has had difficult diplomatic relations with the Islamic Republic. Iran is home to a large ethnic Azeri minority.
There were no indications from Iranian officials that the attack was politically motivated.
But Iran's ties with Azerbaijan have been tense at times.
Azerbaijan appointed its first ever ambassador to Israel this month amid escalating tensions with its large southern neighbour Iran.
Israel has had an embassy in Baku since the early 1990s and has been a significant military backer of Azerbaijan in recent years, including diplomatic support for Baku in its standoff with Armenia over the Nagorno-Karabakh region.
Iran's Revolutionary Guards carried out major military drills along the country’s borders with Armenia and Azerbaijan amid lingering fears of renewed fighting between the two South Caucasus states last year.