A blogger from Singapore who was jailed for online posts criticising his government has been granted asylum to remain in the United States, an immigration judge ruled.
Amos Yee, 18, has been detained by US federal immigration authorities since December when he was taken into custody at Chicago's O'Hare International Airport.
Attorneys said he could be released from a Wisconsin detention centre as early as Monday.
Judge Samuel Cole issued a 13-page decision on Friday, more than two weeks after Yee's closed-door hearing on the asylum application.
Judge Cole wrote: "Yee has met his burden of showing that he suffered past persecution on account of his political opinion and has a well-founded fear of future persecution in Singapore."
Mr Yee left Singapore with the intention of seeking asylum in the US after being jailed for several weeks in 2015 and 2016. He was accused of hurting the religious feelings of Muslims and Christians in the multi-ethnic city-state. Yee is an atheist.
Many of his blog and social media posts criticised Singapore's leaders.
He created controversy in 2015 as the city-state was mourning the death of its first prime minister when he posted an expletive-laden video about prime minister Lee Kuan Yew just after his death.
Such open criticism of political leaders is discouraged in Singapore. The case raised questions about free speech and censorship and has been closely watched abroad.
Judge Cole said testimony during Mr Yee's hearing showed that while the Singapore government's stated reason for punishing him involved religion, "its real purpose was to stifle Yee's political speech".
He said Mr Yee's prison sentence was "unusually long and harsh", especially for his age.
Officials at Singapore's embassy in Washington DC have not addressed the case and messages left for the government on Saturday morning in Singapore were not immediately returned.
Human Rights Watch applauded the decision.
Phil Robertson, the body's deputy Asia director, said: "Singapore excels at creating a pressure cooker environment for dissidents and free thinkers who dare challenge the political, economic and social diktats from the ruling People's Action Party.
"It's clear the Singapore government saw Amos Yee as the proverbial nail sticking up that had to be hammered down."