The court ruled on his release on Tuesday but following an appeal by the prosecution Hussein was brought to a different court on Thursday. It upheld the earlier decision.
However, it remained unclear exactly when the Qatar-based Egyptian producer will be freed from prison.
Hussein’s lawyer Taher Abul Nasr said his release “is expected to take place within days”.
Az-Zahra Hussein, his daughter, said in a Facebook post her father will be released “with precautionary measures”, and will soon be transferred to a police station from prison.
Gamal Eid, executive director of the Arabic Network for Human Rights Information, said under Egyptian law Hussein must be freed within 24 hours.
“This is a final court ruling but the problem is that security forces tend to delay releases when they do not like those freed,” said Eid, adding in some previous cases the execution of the release order took several months.
The journalist has been in custody since 2016 without formal charges, a trial, or a conviction.
Al Jazeera speaks to Mahmoud Hussein’s daughter about his arrest
Hussein was accused of “incitement against state institutions and broadcasting false news with the aim of spreading chaos”, allegations he and Al Jazeera Media Network deny.
Nasr told Anadolu news agency the Cairo Criminal Court rejected the prosecutors’ appeal on Thursday.
“This case shows the misuse of pre-trial detention as a form of punishment in Egypt,” said Eid.
He said there are at least 20,000 people currently in detention without charge in Egypt for political reasons. Hundreds of them have already exceeded the legal two-year pre-trial term, he added.
Since the ouster of Muslim Brotherhood president Mohamed Morsi in 2013, Al Jazeera Media Network has been portrayed as Egypt’s national enemy for its coverage of the group. Many of its reporters have been arrested on grounds of spreading lies and supporting “terrorists” – a reference to the outlawed Muslim Brotherhood organisation.
Hussein’s detention was in violation of both Egyptian and international law, with the former setting 24 months as the maximum period for pre-trial detention.
Egyptian authorities have repeatedly renewed his two-year detention.
He was arrested on December 20, 2016, by Egyptian authorities upon his arrival in Cairo to visit his family.
In 2013, Egypt also arrested and later imprisoned Al Jazeera’s Abdullah Elshamy, Baher Mohamed, Mohamed Fahmy and Peter Greste on charges of spreading “false news” – cases that were widely condemned by international media outlets and many politicians.
All have since been freed.
Ibrahim Helal, former editor-in-chief of Al Jazeera Arabic, was sentenced to death in absentia for purportedly endangering national security. Several other colleagues have also been charged in absentia, such as journalists Sue Turton and Dominic Kane.
Al Jazeera’s Mahmoud Hussein spends 600th day in Egyptian jail
Since his coup ousted Morsi, President Abdel Fattah el-Sisi has waged an unprecedented crackdown on dissent, arresting thousands and rolling back freedoms won after the 2011 uprising that ended decades of rule by Hozni Mubarak.
In 2017, the Egyptian government blocked access to Al Jazeera’s news website along with dozens of others deemed too critical of Sisi’s regime.
According to a 2018 report by the New York-based Committee to Protest Journalists, Egypt along with Turkey and China were responsible for more than half of journalists jailed around the world for the third year in a row.
Reporters Without Borders ranked Egypt 163rd out of 180 in its 2019 Press Freedom Index.