Image copyright Adrian Cole Image caption Ray Cole was detained by police after homosexual images were found on his phone

A 69-year-old British man who was jailed for "homosexual acts" in Morocco has been released, his son has said.

Ray Cole, from Deal, Kent, was sentenced to four months with his Moroccan partner after homosexual images were found on his phone.

Following his release his family thanked the Moroccan authorities for "showing compassion".

Foreign Office guidelines state homosexuality is a crime in the north African country.

On the campaign's Facebook page there was a message saying: "We are delighted to announce that our dad, Ray Cole has been released from prison and is on his way home.

"We would like to thank each and every one of you here and in Morocco who has helped our campaign to secure the release of our wonderful father.

"We would also like to thank the Moroccan authorities for showing compassion.

"We would ask that you allow us some time as a family to absorb the news and to spend some time with Dad."

Mr Cole is understood to have been granted a conditional release pending an appeal.

His son, Adrian Cole, 41, said: "Our legal team in Marrakesh lodged an appeal today.

"It has moved much faster than we expected and the court was able to take the step of releasing my father."

He said he had been told his father left prison in good spirits and with all his belongings, but he left blankets and clothes given to him while he was there for other prisoners who did not have families helping them.

He added that the guards and prisoner governor had treated the family "graciously".

Image copyright Adrian Cole Image caption Ray Cole was put in a part of the prison reserved for older prisoners

Mr Cole was four weeks into a five-week holiday in Morocco when he was detained by police.

He had gone to the north African country to see 20-year-old Jamal Jam Wald Nass for the second time, after developing a friendship on Facebook.

The pair were stopped by police in Marrakesh as they were waiting at a bus stop.

Mr Cole's son has previously said his father was treated well by prison staff and had been put in a part of the prison that was reserved for older prisoners.

A campaign with the #freeraycole hashtag was set up on Twitter along side a Facebook page and online petition.

Mr Cole was expected to fly back to the UK later.

It is not clear whether Mr Nass has also been freed.

A spokeswoman for the Foreign Office said: "We are aware of reports that Mr Cole has been released.

"We have offered full consular support throughout his case and continue to do so. We remain in close contact with his family."