A Brazilian court has ruled that the son of soccer great Pele must be released from jail and allowed to fight an almost 13-year prison sentence for drug-related charges while free.

Edson Cholbi do Nascimento, known as Edinho, turned himself in to police last week to serve a sentence that was reduced from 33 years to 12 years and 10 months.

A judge with Brazil’s Superior Court of Justice ordered he be freed on Wednesday, although Edinho’s lawyer said he would likely be released on Thursday.

A former goalkeeper with Pele’s old club Santos, Edinho was found guilty of drug trafficking and money laundering in 2005 but has been fighting the charges ever since.

He denies the charges and has vowed to keep fighting to clear his name.

His father Pele, 76, is considered the greatest player of all time and helped Brazil to win three World Cup titles.