A blogger, who had faced a military trial for an article critical of Egypt's armed forces, has been released without bail after apologizing and on condition he removes the posting, his lawyer said Sunday.

Ahmed Moustafa, 20, an engineering student, had been charged by a military court with disseminating false information and tarnishing the image of the military. He was detained in Kafr el-Sheikh, a city north of Cairo.

The military court retracted its position and released Ahmed without giving reasons, Moustafa's lawyer, Hamdi al-Assiuty, told Reuters. But he said the authorities had kept the case on file which meant it could be pulled out in future.

A conviction could have resulted in a one-year jail term.

The Committee to Protect Journalists and other rights groups had called on Egypt to drop charges against Moustafa and have criticized the treatment of Egyptian bloggers, who are often rounded up for posting anti-government articles.

Those detained usually face civilian courts.

Rights groups say Egypt uses its Emergency Law, which allows indefinite detentions and trials for civilians in military or other exceptional courts, to secure guilty verdicts. The groups and some Western governments have called for an end to the law.

Egyptian officials say the law is used against those posing a threat to national security or those it labels terrorists.

In a court hearing Saturday, Moustafa apologized for posting the critical blog, saying he was repeating information he received from an email but had not intended to harm the military or anyone else, his lawyer said.

(Writing by Marwa Awad; Editing by Elizabeth Fullerton)