The US citizen and civil rights attorney Asim Ghafoor, who had represented Jamal Khashoggi before the Saudi journalist was murdered, has been freed from custody in the UAE where he was convicted on money laundering charges.

Ghafoor was headed home to the US, said his lawyer, Faisal Gill, having been freed after paying a fine and with help from the US embassy in the UAE.

A court on Wednesday upheld Ghafoor’s earlier in-absentia conviction, ordering him to pay a fine but revoking a three-year jail term handed down in May. UAE officials had no immediate comment.

Ghafoor – former lawyer of Khashoggi, the dissident Saudi journalist who was murdered at Saudi Arabia’s consulate in Istanbul in 2018 – had been transiting through Dubai airport on 14 July when he was detained for the in-absentia conviction, handed down in May, for money laundering and tax evasion that followed a 2020 request for assistance by US authorities.

Abu Dhabi’s judicial department said on Wednesday that the court had confiscated funds illegally moved through the country. He would also be deported, it said.

Habib Al Mullah, a lawyer for Ghafoor, said the court confiscated 18 million dirhams ($4.9m).

US officials have not confirmed the assistance request, but said the arrest was not made at the request of Washington.

Media reports in the US said Ghafoor, who lives in Virginia, had in the past come under US surveillance due to work representing Muslim Americans in civil rights cases.

The in-absentia trial and his detention in July while the US president, Joe Biden, was visiting the region drew criticism from rights groups and members of Congress.

Ghafoor’s supporters said he was denied due process and was unaware of the charges before being detained. Some suggested the arrest could be politically motivated, citing his ties to Khashoggi and work with rights groups critical of the UAE.

US intelligence says Saudi Crown Prince Mohammed bin Salman approved the operation in which Khashoggi was killed. The prince has denied involvement. Saudi Arabia and the UAE are close allies.

UAE officials have repeatedly said the case against Ghafoor was strictly about financial crimes.

With Reuters in Dubai