Brazil and Barcelona legend Ronaldinho has been released from a Paraguayan prison after a month inside.

The World Cup winner was jailed along with his brother in early March after entering the South American country with an illegal passport.

Ronaldinho will remain under house arrest and will live in a hotel in the Paraguayan capital, Asuncion, until he is given the all clear to return to Brazil.

According to news agency EFE, the 2005 Ballon d’Or winner and his brother paid a $1.6million bail for their freedom and will continue to be monitored by local police at their hotel.

"I decided to put them in house arrest because the investigation is now well advanced, differently from the situation one month ago," Judge Gustavo Amarilla said when issuing the ruling.

Last month, Ronaldinho celebrated his 40th birthday inside the prison as inmates organised a barbecue and baked a cake for the former Paris Saint-Germain and AC Milan forward.

He also took part in a football tournament in the jail, helping his team win the competition and first prize: a 16 kg suckling pig.

Ronaldinho had his Brazilian passport seized at home due to an investigation into alleged environmental crimes, but the document was returned to him in September. One month later he played in a friendly in Israel.

If convicted, the former Barcelona star could spend up to five years in jail. Fourteen people are being investigated in the case.

Attorney Sergio Queiroz told The Associated Press that Ronaldinho and his brother will not make public statements until the case is closed.

Ronaldinho came to Paraguay to promote his autobiography. He was jailed in an improvised penitentiary in the south of Asuncion, which is used for 150 dangerous criminals, including convicts of drug dealing, corruption and rape.

During his stay he played soccer with inmates and took pictures with them that were shared on social media.

Additional reporting by AP.