Egypt's President Abdel Fattah al-Sisi during visit to London last week. (Pool/Reuters)

A top Egyptian journalist and rights defender was freed Tuesday after being detained by military intelligence over a story he wrote alleging a coup plot against the president.

The arrest of Hossam Bahgat on Sunday gained worldwide attention, and the United Nations called it “the latest in a series of detentions . . . that are profoundly worrying.”

Egyptian journalists and activists have faced a widespread crackdown since a military coup against Islamist President Mohamed Morsi in 2013, but that has since expanded to target all dissidents and other perceived government critics.

Last month, Bahgat had reported a story on the conviction of 26 officers in a military court for their alleged involvement in a plot to overthrow Egyptian President Abdel Fatah al-Sissi. The article, published on independent news Web site Mada Masr, was the focus of the interrogation, Bahgat’s lawyers said.

On Monday, military prosecutors ordered Bahgat held for four days in pretrial detention while an indictment was prepared on charges of publishing false news with the intent of harming national security. But on Tuesday, Bahgat called his friends to say he was outside the military intelligence building after being released.

Mada Masr, where Bahgat works as an investigative journalist, posted on its Web site that it was still unclear whether the military prosecutor had dropped the charges against him.

“HOSSAM IS FREE. He just called us!!!” Heba Morayef, associate director of the Egyptian Initiative for Personal Rights, the organization Bahgat founded in 2002, posted on Twitter.

Bahgat was released after he signed a document pledging to “abide by legal and security procedures when publishing material pertaining to the armed forces,” Mada Masr said.

According to the Committee to Protect Journalists, 19 journalists are currently in prison in Egypt solely for doing their job.