Justice Russel Zinn gave the government 30 days to get Abousfian Abdelrazik, 47, back to his family in Montreal, the Canwest News Service reported.
"The applicant's right to enter Canada has been breached," Zinn wrote in his ruling, adding the man was "as much a victim of international terrorism as the innocent persons whose lives have been taken by recent barbaric acts of terrorists."
Abdelrazik filed the court petition from the Canadian Embassy in Khartoum, where he has been living for more than a year, the Canadian Broadcasting Corp. reported.
He went to Sudan in 2003 to visit his ailing mother. While he was there, his name was added to the U.N. no-fly list as a suspected al-Qaida terrorist, the reports said.
He was arrested by the Sudanese in 2003 and again in 2005, and spent 20 months in prison, Canwest said.
Despite being cleared by the Royal Canadian Mounted Police and Canadian Security Intelligence Service, the Canadian government refused to allow him back.
Federal officials said the ruling was under review as to whether a Supreme Court appeal would be filed, the CBC said.
Couple mistakenly served bag of cash at McDonald's drive-thru
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'