Hannibal Gaddafi's arrest sparked a major diplomatic spat
A Libyan appeal court has overturned a 16-month jail term handed down to a Swiss businessman on a charge of overstaying his visa.
Rachid Hamdani, thought to be staying at the Swiss embassy in Tripoli, was convicted in absentia along with another Swiss businessman in December.
Analysts suggest the case was brought in retaliation for the July 2008 arrest of Muammar Gaddafi's son in Geneva.
Mr Hamdani and his co-accused also face charges of illegal business activities.
"The appeal court acquitted Rachid Hamdani and overturned his prison term for overstaying" the visa, Mr Hamdani's lawyer, Salah Zahaf, told AFP news agency on Sunday.
Correspondents have said the case is linked to the arrest of Hannibal Gaddafi and his wife in Switzerland on charges, later dropped, of assaulting two servants.
Libya retaliated by cancelling oil supplies, withdrawing billions of dollars from Swiss banks, refusing visas to Swiss citizens and recalling some of its diplomats.
In the same month the Gaddafis were arrested, Libyan authorities detained Mr Hamdani, who works for a construction company, and his fellow countryman Max Goeldi, an engineering firm manager.
The pair were later released on bail and went to stay at the Swiss embassy in Tripoli, before they were convicted in absentia on an immigration offence in December last year.
Mr Goeldi has also appealed against his jail sentence and a ruling is due on 4 February, according to AFP.
Both men still face charges of illegal economic activities and a verdict in that case is also expected next week, said Mr Hamdani's lawyer.
The pair are accused of tax evasion and operating a business without a licence.
The BBC's Rana Jawad in Tripoli says Sunday's ruling will be celebrated in Switzerland, where the media and officials have long described the two as hostages.
The latest ruling may be a signal that the diplomatic dispute is being resolved, our correspondent says.
Swiss President Hans-Rudolf Merz visited Tripoli last August and apologised for the arrest of Hannibal Gaddafi.
But the proceedings continued against the two businessmen, intensifying public outrage in Switzerland.
Tripoli has repeatedly denied suggestions the legal action is linked to the wrangling between Libya and Switzerland.