CBC News has learned that a Canadian couple who were detained in Turkey for months has been released without charges and are heading back to Canada.

A senior government source told CBC News the couple's problems began when they took a drive along the Syrian border in July. That prompted the Turkish authorities to pick them up on suspicion of terror-related activity.

On Tuesday, Haleema Mustafa and Ikar Mao were released and free to return to Canada. They will not face any charges.

Sources told CBC News the Turkish government had been preparing terror-related charges against them because they were suspected of trying to join ISIS.

The case was deemed confidential within the Turkish court system.

Friends and family members told CBC News the RCMP had questioned them on whether the couple had been radicalized.

Security officials told CBC News the pair were not on any watch list before they left for Turkey and were not being monitored by Canadian officials.

It's not clear what prompted Mustafa and Mao's release after three months in custody.

On a website for travellers looking for free accommodation, Mao had written that he and his wife wanted to find somewhere to stay in Sanliurfa, a Turkish city less than 50 kilometres from the Syrian border, known as a hotspot for human smuggling and a gateway for foreign fighters attempting to enter Syria.

He said they wanted to learn Turkish and Arabic and wanted to move there soon.

Neither Mustafa nor Mao's family has responded to requests for comment.

A spokesperson at Global Affairs Canada, in an email to CBC News on Thursday, declined to comment on the case, saying only that the department is aware two Canadian citizens were detained in Turkey and that consular services are being provided.