A Thai court ordered the release of refugee footballer Hakeem al-Araibi on Monday after prosecutors said they were no longer seeking his extradition to Bahrain.
Court spokesman Suriyan Hongvilai said Al-Araibi, who lives and plays football in Australia, was being processed for release.
On Monday, prosecutors submitted to court a request to withdraw the case to extradite Al-Araibi to Bahrain, where he faces a 10-year prison sentence for an arson attack that damaged a police station.
He has denied the charge and said the case, which has attracted worldwide attention, is politically motivated.
Prosecutors made the decision after Thailand's foreign ministry sent a letter on Monday morning indicating that Bahrain had withdrawn its request for Al-Araibi, Chatchom Akapin, director general of the attorney general office's international affairs department, said.
Officials in Bahrain did not immediately respond to a request for comment on Monday.
The state-run Bahrain News Agency (BNA) reported on Sunday that Prime Minister Khalifa bin Salman Al Khalifa had a phone call with Thai Prime Minister Prayuth Chan-ocha, but offered no details of their discussions.
Separately, BNA said Bahrain's Crown Prince Salman bin Hamad Al Khalifa had met Thailand's foreign minister, who was visiting the island, on Sunday. Again, no specific details of the talks were given.
In a statement, world players' union FIFPro said it was delighted that Al-Araibi had been released.
"We trust Hakeem can now live in peace in Australia and, as a protected refugee, regain his lawful right to travel without fear," the statement said.
"We salute the tireless campaigning of Craig Foster and Professional Footballers Australia to secure Hakeem's release.
"We also recognise the solidarity shown by scores of football players who helped raise awareness about his wrongful detention."
Al-Araibi, 25, a former Bahrain national team player, has said he fled his home country due to political repression. He has been living in Melbourne, where he plays for a semi-professional team.
His supporters have said he should be freed and is protected under his status as a refugee with Australian residency.
He was detained upon his arrival in Bangkok in November, while on a holiday, at the request of Bahrain relayed through Interpol.
Al-Araibi has said he was blindfolded and had his legs beaten when he was held in Bahrain previously. He said he believed he was targeted for arrest because of his Shia faith and because his brother was politically active in Bahrain
Bahrain has a Shia majority but is ruled by a Sunni monarchy.