Updated

A Mauritanian court on Sunday freed a Canadian jailed for attempting to join an Al-Qaeda training camp in neighbouring Mali, a judicial source said.

Aaron Yoon was serving two years in Nouakchott after being convicted in July last year when he was 24, but his sentence was reduced in an appeal brought by the prosecution who were asking for the term to be extended to 10 years, the source said.

"The Canadian Aaron Yoon was sentenced by an appeals court on Sunday to a year and a half in prison but he has already spent this time in jail and must therefore leave the penitentiary immediately," the source told AFP on condition of anonymity.

Yoon, who is of Korean descent, was arrested in December 2011 when he tried to visit the camps of Al-Qaeda in the Islamic Maghreb (AQIM) in Mali, according to the indictment against him.

He denied any link to terrorism, saying he had come to Mauritania from Morocco to study the Koran and learn Arabic, but the authorities maintained he had "strong links with AQIM terrorists and his plan to join the movement is indisputable".

"We cannot say how and when but he must leave the prison and will probably be removed from the country," the judicial source said.

Mauritania shares over 2,200 kilometres (1,350 miles) of border with Mali, where a French-led military operation was launched against armed Islamist groups in January, driving them out of cities in the country's vast desert north.