An Iranian diplomat who was arrested by Egyptian security agents on suspicion of spying has left Cairo for Iran.

Qassem al-Husseini, third secretary at Iran's diplomatic mission in Cairo, was arrested on Saturday and questioned on suspicions of illegally gathering intelligence and trying to set up spy rings in Egypt and Gulf countries, Egypt's state news agency said.

He was released Sunday because of his diplomatic immunity and left Cairo on Monday on an Emirates airline to Dubai.

In an ironic twist, al-Husseini's plane was also carrying a 45-member delegation from the Egyptian-Iranian friendship society, which aims to restore political ties between the countries.

Relations between Iran and Egypt have been frosty since the 1979 Iranian Revolution and Egyptian-Israeli peace accord.