Updated

China said Friday that a Canadian citizen it detained for two years over spying allegations was allowed to leave the country after a local court issued a verdict in his case, but it refused to say what the verdict was or why he was detained at all.

Kevin Garratt's return to Canada was announced Thursday by Prime Minister Justin Trudeau, who said he had pressed Garratt's case with top Chinese officials.

Garratt had been indicted by prosecutors in Dandong, a city on the North Korean border where he and his wife ran a popular coffee shop and conducted Christian aid work for North Koreans. He and his wife, Julia, were arrested in August 2014 by the state security bureau. While his wife was released on bail, Garratt remained in custody.

China's Ministry of Foreign Affairs, in a faxed statement Friday, said Garratt had been treated "according to law." It said China "fully guaranteed all kinds of procedural rights of Kevin Garratt, and fully respected and implemented the consular rights of the Canadian side," the ministry said.

But the ministry declined to say what investigators found or what the outcome of the trial was. A person who answered the phone at the court on Friday, a Chinese state holiday, said officials were not available to discuss the case.

Chinese state media have previously reported that authorities found evidence that implicated Garratt in accepting tasks from Canadian espionage agencies to gather intelligence in China.

Courts in China are widely seen as a tool of the ruling Communist Party and issue decisions in line with the government's thinking on a case.

Garratt's release comes as both sides pledged to strengthen economic ties during Trudeau's visit to China earlier this month for the Group of 20 economic summit, and one week before Premier Li Keqiang is to visit Canada for talks with Trudeau.

___

Gillies reported from Toronto, and AP researcher Yu Bing contributed from Beijing to this report.