Family members in Canada contacted by the Associated Press said the two were at a hotel, recuperating from the effects of their jail time and catching up with family members by phone and email.

Canadian officials, in carefully worded statements, expressed gratitude to Egyptian authorities for allowing consular access to its citizens, and expressed hopes that the men would soon be reunited with their families.

Greyson and Loubani were detained on Aug. 16 amid heavy clashes in the Egyptian capital as security forces dispersed followers of deposed Islamist president Mohamed Morsi. Violence erupted in Cairo again on Sunday as the two were attempting to leave, with pro- and anti-government forces staging rival street demonstrations and security forces firing on Islamists who tried to mass in several city squares. At least 51 people were killed and more than 250 injured, Egyptian officials said.

While the two men were being detained without charges, supporters had staged a publicity campaign demanding their release. They gathered petition signatures, enlisted well-known Canadians to speak out about the case and created a website that was updated with news of the two, including a letter they wrote last month from jail that described beatings and being held in a crowded, cockroach-infested cell.

Thousands of followers of Morsi’s Muslim Brotherhood have been imprisoned since his ouster, including hundreds more arrested during Sunday’s protests.

The case of Greyson and Loubani case provided an unusual glimpse into harsh conditions routinely endured by Egyptian detainees, and also contradicted the notion that foreigners in the country enjoyed a degree of protection against such treatment.