A Toronto-area man detained in Egypt for nearly two years after that country's former leader Mohammed Morsi was ousted by military forces has quietly returned to Canada.

A permanent resident of Canada and a father of four, Khaled Al-Qazzaz was reunited with his family in Mississauga, Ont. on August 14, his brother-in-law Ahmad Attia told CBC News on Thursday.

Qazzaz, who was an aide to Morsi, was released from custody early last year but was barred from leaving Egypt until just weeks ago.

"Khaled has been reunited with wife Sarah and the children … Our family has been overwhelmed with joy to finally bring this ordeal to an end," Attia said in an email.

"For three years our family and supporters across Canada and internationally have advocated for Khaled's freedom and the family's return home. It wasn't easy but we never gave up. When we found out he was coming home it was a dream come true."

​The 36-year-old University of Toronto engineering graduate was arrested in 2013 but was never charged with anything and Egyptian authorities have so far not provided an explanation for his detention.

Arrest coincided with journalist Mohamed Fahmy's imprisonment

Canadian-Egyptian Mohamed Fahmy was being held in harsh conditions in an Egyptian jail at the same time Al-Qazzaz was imprisoned. An Egyptian court accused Fahmy, who was a journalist with Al-Jazeera at the time, of supporting the Muslim Brotherhood by airing what the court called "false news," and sentenced Fahmy to three years in prison on terror-related charges.

Fahmy returned to Canada in October of 2015, but Egypt continued to thwart Al-Qazzaz's attempts to come home.

Omar Alghabra, the parliamentary secretary to Canada's minister of foreign affairs and the Liberal MP for Mississauga Centre, confirmed Al-Qazzaz's return to CBC News on Thursday.

"We're very happy that he's reunited with his family in Canada," Alghabra said, adding that he was heartened to see Mississauga residents show their concern and support for Al-Qazzaz's well-being throughout his ordeal.

A previous attempt by Al-Qazzaz to return to Canada in April 2015 was unsuccessful after he and his family were stopped at Cairo's airport and had their passports and money confiscated, Attia said at the time.

Attia told CBC News Al-Qazzaz is receiving the medical care he needs and that he and his wife are focusing on recovering from their ordeal.

Al-Qazzaz suffered from a severe spinal condition related to his detention that required surgery and had been hospitalized during the last two months of his detention, Attia said.

Allowed return on medical, humanitarian grounds

Attia told CBC News that Egyptian authorities allowed Al-Qazzaz to return on medical and humanitarian grounds.

Al-Qazzaz's release was the outcome of thousands of Canadians' support and advocacy, human rights groups and politicians, he said.

In particular, Mississauga-Lakeshore MP Sven Spengemann followed-up regularly with the federal government, Attia said.

Al-Qazzaz's case attracted widespread attention from human rights groups, including Amnesty International.

The Canadian government, Attia said, played an important role in resolving the ordeal, with the case taking a significant turn after Alghabra visited Egypt in May and raised the case with senior officials there.

Former foreign affairs minister John Baird also raised Al-Qazzaz's case with the Egyptian government while the Conservative party was in power.

Sarah Attia talks about her husband Khaled Al-Qazzaz, a Canadian permanent resident who has spent over 9 months in an Egyptian jail without charge 7:13

Direct consular assistance wasn't possible in Al-Qazzaz's case given he is a permanent resident and not a Canadian citizen.

"We do care about individuals who have links to Canada and who have family in Canada and we look at these on a case-by-case basis," Alghabra said Thursday when asked if this case — and that of other permanent residents detained in various parts of the world — points to a larger problem that the federal government needs to address.

Back at home in Mississauga, Al-Qazzaz and his wife will focus on rebuilding their lives and re-establishing themselves in the field of education which has been their passion for years since graduating from the University of Toronto, Attia said.

And while few in Canada will ever experience the ordeal that Al-Qazzaz and his wife have, the couple are now looking forward to doing something much more normal: getting their children ready for school next week.