On Friday morning a man armed with a Kalashnikov rifle identified as Yasin Hosseinzadeh barged inside the embassy premises and opened fire, killing one person.
Azerbaijan has evacuated staff from its embassy in Iran’s capital Tehran, two days after a gunman killed one person there and wounded two others.
A total of 53 people, including diplomats and their family members, boarded a special plane that landed at Heydar Aliyev International Airport in the capital Baku at 10 p.m. local time (1800GMT), Azerbaijani media said on Sunday.
The plane also carried the body of Orkhan Askerov, the chief of the embassy security staff, who was killed in the attack, which drew strong condemnation worldwide.
The incident took place on Friday morning when a man armed with a Kalashnikov rifle identified as Yasin Hosseinzadeh barged inside the embassy premises and opened fire.
Tehran's police chief Hossein Rahimi told reporters the assailant was immediately arrested, adding a preliminary investigation pointed to "personal and family-related problems" as a possible motive for the attack.
The evacuation took place hours after Iranian President Ebrahim Raisi and his Azerbaijani counterpart Ilham Aliyev had a phone call to discuss the issue, during which Raisi said a thorough investigation was underway.
A statement issued by his office quoted Raisi as saying that the governments of the two countries "will not allow bilateral relations to be affected by ill-wishers."
READ MORE: Armed attack targets Azerbaijan's embassy in Iran
Aliyev had earlier denounced the attack as a "terrorist act" and demanded a probe. The country's Foreign Ministry also summoned the Iranian ambassador.
Speaking to reporters in Baku on Sunday, Azerbaijan's Deputy Foreign Minister Khalaf Khalafov held Iran responsible for the attack and its consequences, as reported by Azerbaijani media.
He said the attack was "unexpected," adding host countries are required to fulfil their obligations under the Vienna Convention to ensure the security of foreign diplomatic missions on their territory.
The senior Azerbaijani diplomat added that President Aliyev had decided to evacuate the embassy in the Iranian capital, terming it a "difficult decision" and adding that they have "no hope and no confidence."
Meanwhile, Iran's semi-official ISNA news agency cited an "informed source" in the Foreign Ministry as saying that the operations of the Azerbaijani embassy shall continue, albeit with a smaller diplomatic staff.
Azerbaijan's Foreign Ministry spokesperson Aykhan Hajizada had on Saturday announced that a plane would be sent to Tehran to bring back diplomatic staff as well as the body of the slain embassy security chief.
The incident has increased tensions between Iran and Azerbaijan, two neighbouring countries that share a 765-kilometre (475-mile) border.
Iranian authorities insist that it was not a terrorist attack but carried out with personal motivations.
READ MORE: What a dust-up with Azerbaijan tells us about Iran's foreign policy