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”…