Cairo (AFP) - Egypt's military on Tuesday freed prominent rights defender and reporter Hossam Bahgat, a day after his detention sparked calls for his release from the United Nations.
Rights group Egyptian Initiative for Personal Rights, the group he had founded, released a picture of him in its offices after he walked free.
Bahgat, 36, had been summoned by the military on Sunday for questioning over an investigative report on a military trial.
He was held overnight and then military prosecutors remanded him in custody for four days.
The media site Bahgat works for, Mada Masr, said he had been freed after he signed a document pledging to follow "legal and security procedures when publishing material pertaining to the Armed Forces".
The document he signed also said "I was also not subjected to any moral or physical harm", the news outlet reported.
Thousands of activists, mostly Islamists but also leftists, as well as several journalists, have been detained since former army chief and now President Abdel Fattah al-Sisi overthrew his Islamist predecessor Mohamed Morsi in 2013.
His ouster unleashed a bloody crackdown on protesters that killed hundreds of demonstrators, while militants launched an insurgency that killed hundreds of policemen and soldiers.
But Bahgat's detention drew swift attention owing to his longstanding work as one of the country's top human rights defenders, as well as his more recent investigative pieces for independent news site Mada Masr.
The spokesman for the UN High Commissioner For Human Rights had earlier urged Egyptian authorities "to release Mr Bahgat without delay".
"The case of Hossam Bahgat, the latest in a long line of arrests and imprisonment of independent journalists in Egypt, is disturbing on a number of fronts," spokesman Rupert Colville told reporters.
- Egypt criticises UN chief -
UN Secretary General Ban Ki-moon was "concerned" about Bahgat's detention, his spokesman wrote on his Twitter account, drawing an angry rebuke from Egypt's foreign ministry.
Egypt "denounces" the comment, the foreign ministry said in a statement, saying it dealt with a "specific case" and was "jumping to conclusions".
"It would have been more in accordance with the professional responsibility of the secretary general to exercise accuracy and concern for general cases relating to collective violations against people denied basic rights," the statement said, without clarifying which people it was referring to.
Bahgat had been detained on suspicion of violating a law that bans spreading "false" news that damages the country's interests.
Under Egypt's constitution, the military may prosecute and try civilians if the violation is against broadly defined military interests.
In 2013, three reporters with Al-Jazeera were detained and later tried and convicted on similar charges, and for alleged ties with Morsi's blacklisted Muslim Brotherhood movement.
Their trial sparked international criticism led by the White House and the United Nations.
One of them, Australian Peter Greste, was deported early this year and the remaining two, Canadian Mohamed Fahmy and Egyptian producer Baher Mohamed, were pardoned by Sisi.
Bahgat's detention may have come as an embarrassment to the president, who had said he wished the Jazeera reporters had never been put on trial in the first place.
Sisi has said that the country now enjoys "unprecedented" freedom of expression, and his government has said it does not jail journalists.
His government has also denied there are political prisoners in the country, saying secular and Islamist dissidents jailed had all violated protest laws or committed acts of violence.