A lawyer for John McAfee said Tuesday night a judge has ordered the software entrepreneur freed from a Guatemalan jail where he has been fighting being returned to Belize.

Lawyer Telesforo Guerra told the Associated Press the judge notified him verbally of the ruling, but added that it may take a day for formal written notification to win McAfee's release, perhaps as soon as Wednesday.

Judge Judith Secaida did not immediately return AP phone calls seeking to confirm the ruling.

Guerra said Secaida has ruled that McAfee's detention is illegal, ordered him released, and gave him 10 days to get his immigration situation in order. It was not immediately clear if McAfee could secure a temporary or transit visa to leave Guatemala.

He has said that he wants to return to the United States with his 20-year-old Belizean girlfriend. Guerra agreed that that would be his best option.

"For me, it's best that McAfee go to the United States, that's definitely the country where he will be safest," Guerra said. "In Guatemala, he runs the risk that anything could happen to him."