MONTEVIDEO (Reuters) - A former Guantanamo prisoner who was resettled in Uruguay but has asked to leave was denied entry to South Africa by that country’s migration authorities, a Uruguayan official said.

Jihad Diyab, a Syrian national who had planned to travel to South Africa as a tourist, will return to Uruguay on Saturday, said assistant secretary to the president Juan Andres Roballo.

Diyab had left Uruguay on Thursday and paid his own way to Johannesburg and would have had to either return to Uruguay in 90 days or find another country to give him residency.

Diyab was held for 12 years in the U.S. military prison at Guantanamo Bay, Cuba, without being charged. He was released along with five other prisoners to Uruguay in 2014 to reduce the number of detainees.

Earlier this year, he traveled through Brazil and Venezuela, and was held briefly after arriving in Caracas in July. While there a lawyer said he asked the Uruguayan consulate to help him travel to Turkey, where he wanted to reunite with his family.

He was deported back to Uruguay and went on a hunger strike for 68 days in Montevideo, demanding to be resettled.

Uruguay has agreed to extend financial assistance to the former detainees in the country for another year.