Egypt freed an Iranian diplomat on Sunday who had been detained over spying allegations after his diplomatic status was confirmed but said his activities had breached protocol, the official news agency MENA reported.
Iranian television had denied the man, named as Qassem Hosseini, had been detained but cited its source as saying Tehran was dealing with the case through official channels.
Ties between Egypt and Iran were severed after Iran's 1979 Islamic revolution and after Egypt made peace with Israel the same year. But they have been improving since a popular uprising toppled Egyptian President Hosni Mubarak on February 11.
Although Egypt and Iran do not have full diplomatic relations, each has a diplomatic mission in the other's capital.
MENA said Hosseini's status was confirmed by Egypt's Foreign Ministry but also cited an official as saying he had been acting in a way that "violated diplomatic cooperation protocol."
Earlier, MENA said Hosseini "was accused of spying for a foreign country, Iran, with the intention of harming the interests of Egypt."
It said initial investigations by state security prosecutor Taher el-Kholy showed Hosseini was "gathering information regarding recent events in Egypt ... then sending it to Iranian intelligence."
Al-Alam television, an Arabic news channel owned by the Iranian state, cited an Iranian source as saying Hosseini was at work in his Cairo office on Sunday. The source added that Iran was "reviewing the issue through official channels."
Tehran sees the prospect of improved ties with Egypt as one of the desirable outcomes possible from what it calls the "Islamic awakening" in the Arab world which it hopes will reduce U.S. influence in the region and unite Muslim countries. Egyptian Foreign Minister Nabil Elaraby said after meeting an Iranian official in Cairo in April that Egypt was open to re-establishing diplomatic relations.
Under Mubarak, a close ally of the United States who regularly met top Israeli officials, Shi'ite Iran and Sunni Egypt had sparred for influence in the Middle East.
In February, after Mubarak was deposed, two Iranian warships passed through Egypt's Suez Canal with approval from the military rulers in Cairo, the first such crossing since the Islamic revolution. Israel called Iran's move a provocation.