Egypt's army-backed authorities released two Canadians held without charge since political clashes in mid-August, a statement released by the Canadian foreign affairs department said.
John Greyson and Tarek Loubani said they were in Cairo before going to the Gaza Strip where Loubani was due to teach a medical course while Greyson made a documentary about him.
They went to see the protests on August 16 and were arrested at a check point, then searched and beaten, they said. The two men were taken to Cairo's Tora prison, where members of ousted President Mohamed Morsi's Muslim Brotherhood are being held.
They started a three-week hunger strike to protest against their detention on September 16. It ended on Thursday.
Their lawyer, Marwa Farouk, told Reuters they were freed from jail at about 01:00 A.M. on Sunday morning (2300 GMT on Saturday) and were in the Canadian embassy a few hours later.
"The prosecutor general granted us the appeal I raised in court and they are already on a plane to Toronto," she said.
At least 2,000 people, most of them Morsi supporters, have been arrested since he was deposed by the army on July 3.
Security forces killed hundreds on August 14, when police officers and soldiers broke up two Cairo protest camps.
Amnesty International says scores of those arrested have been deprived of basic legal rights.
Want to enjoy 'Zen' reading - with no ads and just the article? Subscribe todaySubscribe now