Canadian journalist Mohamed Fahmy has been ordered released on bail and is expected to be released from a Cairo prison in the days ahead — but his lawyer Amal Clooney cautions that the Al-Jazeera journalist’s legal woes are not yet over.

Fahmy, who was born in Egypt, was arrested along with two colleagues from Al Jazeera in December 2013. They were accused of supporting the Muslim Brotherhood and spreading false news to undermine Egypt's national security.

At an initial trial held in February 2014, Fahmy and his colleagues rejected the charges against them and pleaded not guilty – but all three were convicted and handed multi-year sentences. Egypt's top court later ordered a retrial, saying their conviction was based on "flawed evidence" and that the trial was marred by violations of the defendants' rights.

Thursday's bail order was a surprise, CBC’s Derek Stoffel said from Cairo, as bail orders are rarely handed down in Egypt in terrorism-related cases.

Clooney said in a statement she was encouraged by the court’s ruling to grant bail but cautioned that there’s no guarantee the upcoming retrial would unfold "in compliance with international standards or result in the full acquittal on all charges that Fahmy deserves."

Family 'ecstatic' but will keep pushing

It was difficult to see Fahmy’s reaction as the jailed journalist was locked up behind dark glass and metal bars in the prisoners cage, Stoffel reported.

"I never expected it," Fahmy’s fiancée Marwa Omara said after the judge announced his decision that Fahmy be released on bail of $41,000. "I want to see him without the prison clothes. I want to see his smile back."

Fahmy’s brother Adel said he was "ecstatic" at the thought of having his brother back.

"We all suffered too much, we suffered too much throughout this," he said. "It’s the best feeling right now."

Fahmy’s family had initially hoped he’d be released as early as Thursday night but it now looks like he could be out of prison as early as Saturday.

The bail announcement drew applause from the packed courtroom and prompted Fahmy's fiancée to cheer "long live justice."

"I just want to say thank you Egypt, thank you for doing the right thing," Omara told reporters, adding she and Fahmy could now plan their long-delayed wedding.

'Not over yet'

In a release sent to the media after the bail announcement, Clooney noted that the retrial, which has now been pushed back to Feb. 23, could take "several months" to complete.

"So this case is not over yet; but it should be," Clooney's statement said.

Mohamed Fahmy's fiancée, Marwa Omara, is in Cairo for the retrial, and cheered after the journalist was granted bail. (CBC)

Judge Hassan Farid granted bail about an hour after the start of the retrial of Fahmy and co-accused Egyptian cameraman Baher Mohammed, who was also ordered released.

The two have been in prison on terror-related charges since December 2013, when they were arrested along with Al-Jazeera English colleague Peter Greste, an Australian.

In her statement, Clooney argued that Fahmy is eligible for transfer under the same law that allowed Greste’s return to Australia in early February.

Fahmy has already renounced his Egyptian citizenship after being told by officials he had to do that to be eligible for transfer back to Canada.

"I didn't ask to give up my Egyptian citizenship — I was asked to do so," Fahmy told the court Thursday.

The journalist was wearing a sling for his shoulder that has been injured since before his arrest and worsened in detention. He said security officials had asked him to give up his citizenship, because the case had become a "nightmare" for Egypt, and an official told him "citizenship is not a piece of paper. It is in the heart."

Al-Jazeera journalist Mohamed Fahmy raises an Egyptian flag during his retrial at a court in Cairo Thursday. (Asmaa Waguih/Reuters)

Clooney said in her statement that "just days ago" Fahmy, his lawyers and Canadian officials were told that "his release was imminent." But in the days since, the complex legal case has continued, prompting both Clooney and Fahmy's family to call on the Canadian government to do more.

Fahmy’s family and lawyer are calling on Prime Minister Stephen Harper’s government to do more, imploring him to intervene directly in Fahmy's case with Egyptian President Abdel Fattah el-Sissi.

Asked Thursday whether he'd spoken directly to el-Sissi, Harper wouldn't say so directly, but did suggest he'd been in touch with his Egyptian counterpart.

"Our government has for sometime now has been in contact with Egyptian authorities at all levels, including my level," Harper said. "We will continue to press for his release and we do remain optimistic this case will be resolved."

Canadian Journalists for Free Expression said it was heartened by the release of the two Al-Jazeera men. "However, we continue to call for the charges against these journalists to be dropped unconditionally and for them to walk free," executive director Tom Henheffer said in a statement.

Mohamed Fahmy timeline: