Egypt has pardoned and released two Al-Jazeera journalists who had been jailed for disseminating “false news” in a trial widely criticised as a political charade by human rights groups and international observers.

Canadian journalist Mohamed Fahmy and Egyptian national Baher Mohamed were pardoned by the president, Abdel Fatah al-Sisi, along with about 100 other prisoners, including activists and a poet.

Egyptian presidents have traditionally freed prisoners for the Muslim holiday of Eid al-Adha, which is celebrated this week. But the latest releases also come on the eve of a trip to New York by Sisi, who will attend the UN general assembly where he would likely have faced questions about the controversial case.

Fahmy, who was released outside his old high school in Cairo after being driven there, said he was preparing to celebrate freedom. His lawyer, Amal Clooney, welcomed the decision to correct “a long-standing injustice” but said her client had endured a protracted ordeal.

A friend, journalist Samer al-Atrush, posted pictures of Fahmy, his wife and Mohamed shortly after the men were released, and while they were still wearing prison clothes.

It was not clear if Sisi also pardoned a third journalist, Australian Peter Greste, who had been on trial with his colleagues and spent 400 days in an Egyptian jail before being deported in February under a law allowing prisoners to serve out detentions in their home countries.

The state-run Mena news agency said a third person from the Al-Jazeera case had been pardoned, but there were several other foreign defendants beside Greste who avoided jail because they were outside Egypt when police arrested the three men.

“Reminder that as well as Baher and Fahmy, there are seven other [Al-Jazeera journalists] convicted in absentia whose lives have been affected,” the network’s spokesman Osama Saeed said on Twitter.

The case had drawn condemnation from around the world, including from the US secretary of state, John Kerry, and Australia’s new prime minister, Malcolm Turnbull, who had promised Greste he would push for a pardon.

A spokeswoman for Canada’s foreign affairs department, Rachna Mishra, reportedly said Canada was pleased with the pardon and would help facilitate Fahmy’s departure. “We look forward to Mr Fahmy reuniting with his family and loved ones, and his return to Canada,” she told AP.

Fahmy gave up his Egyptian nationality during the trial in hope of being deported to Canada.

He has also distanced himself from al-Jazeera , where he worked for the English-language channel, accusing the network of placing him and his colleagues in danger, lying about the channel’s legal status in Egypt and displaying editorial bias in favour of Islamists. He is suing the network for damages in a Canadian court. Al Jazeera denies the claim.

Additional reporting by Jahd Khalil in Cairo