(Adds Libyan ambassador's comment on Egyptian state TV)
CAIRO, Jan 27 (Reuters) - A Libyan militia commander was released in Egypt after Egyptian diplomats kidnapped in Tripoli were freed, the Libyan ambassador to Cairo told Egyptian state television on Monday.
Libyan and Egyptian government officials said there had been no deal to free Shaban Hadia, also known as Abou Abeida, in exchange for the diplomats.
"Shaban has been released," Fayez Jibreel told Egyptian state television, saying Hadia had been arrested for staying in Egypt after his residency permit had expired.
Libya's Deputy Foreign Minister Abdul Razak Al-Grady announced on Sunday that the five Egyptian diplomats kidnapped last week in response to Hadia's detention had been freed.
Their abduction in the Libyan capital illustrated the fragility of government control over former rebels and militias who two years ago helped topple Muammar Gaddafi.
Egypt's Interior Ministry issued a statement late on Sunday saying authorities were examining Hadia's presence in Egypt as his residency permit had expired.
"It is a completely separate issue from the release of the Egyptian nationals," Foreign Ministry spokesman Badr Abdelatty told Reuters.
"They are all ok, hopefully they will come back today on a flight from Tripoli," Abdelatty said.
Hadia is expected to travel to Libya later on Monday, Alexandria-based security sources said. (Reporting By Shadia Nasralla; Editing by Janet Lawrence)
Our Standards: The Thomson Reuters Trust Principles.