Singapore teen blogger Amos Yee, who was jailed twice in his homeland for posting political and religious criticism online, has been granted asylum in the United States.
Mr Yee, 18, has been detained in the US since he arrived at Chicago's O'Hare airport in December.
He came into the country on a tourist visa but told immigration officials he was seeking refuge.
Following Friday's ruling, he is expected to be released shortly.
The US Department of Homeland Security opposed Mr Yee's asylum application, but the immigration judge ruled in the teenager's favour.
Judge Samuel Cole released a 13-page decision, which said Mr Yee faced persecution in Singapore for his political opinions.
"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," Judge Coel ruled.
"Accordingly, this court grants his application for asylum."
Celebration and sympathy - Tessa Wong, BBC News Online, Singapore
Amos Yee is not the only one celebrating his US asylum win - many Singaporeans are pleased as well.
"Finally... hopefully it is the last we have heard of him," a Facebook user wrote in one typical comment online.
The teenage critic is one of Singapore's most controversial figures, where he is viewed with exasperation but also a measure of sympathy. Singapore is known for its strict rules on free speech, especially when it comes to race and religion - rules which the US judge said have been used by the authorities to constrain dissent, but which many in the city-state support.
Following Mr Yee's explosive remarks about the country's deeply-revered late leader Lee Kuan Yew and Christianity, Mr Yee had continued to fall foul of the law by breaching bail conditions and making further critical comments about religion.
Even by leaving Singapore he has committed an offence, as he is avoiding mandatory military conscription. While in US detention he had run into trouble for making remarks about Islam, according to his representatives.
But some Singaporeans also empathise with Amos, who has clearly struggled with the country's restrictions. "Congratulations Amos. He can now lead the free life he wants in the free world. It's just his bad luck that he was born in Singapore," said another commenter on Facebook.
Mr Yee's lawyer, Sandra Grossman, said he could be released as early as Monday.
In statement, Ms Grossman applauded the judge's decision and said, "The right to free speech is sacred, even when such speech is considered offensive."
In September 2016, the teenager was given a six-week prison sentence in Singapore after being found guilty of "wounding religious feelings".
He had posted a video critical of Christianity and Islam.
He was also jailed by a Singapore court for four weeks in 2015, for criticising Christians and for posting a video about the country's former Prime Minister Lee Kuan Yew.
His video, posted on YouTube days after his death, compared the widely-respected founding father of Singapore to Jesus Christ.
Later, he posted a crude cartoon depicting Lee Kuan Yew and former UK Prime Minister Margaret Thatcher, who was one of his allies.
The posts provoked various police complaints, and Mr Yee was reported to have received violent threats.