A teenage blogger from Singapore whose online posts blasting his government landed in him jail was granted asylum to remain in the United States, an immigration judge in Chicago ruled.

Amos Yee has been detained by federal immigration authorities since December when he was taken into custody at Chicago’s O’Hare International Airport. Attorneys said the 18-year-old could be released from a Wisconsin detention center as early as Monday.

Judge Samuel Cole issued a 13-page decision more than two weeks after Yee’s closed-door hearing on the asylum application.

“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 Cole wrote.

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; Yee is an atheist. However, 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 and he posted an explicative-laden video about Prime Minister Lee Kuan Yew just after his death.

Such open criticism of political leaders is discouraged in Singapore. The case, which raised questions about free speech and censorship, has been closely watched abroad.

Judge Cole said testimony during 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 Yee’s prison sentence was “unusually long and harsh” especially for his age.

Officials at the Singapore embassy in Washington, D.C., have not addressed the case and messages left on Friday weren’t immediately returned.

Yee’s attorney Sandra Grossman said her client was elated with the news.

“He’s very excited to begin new life in the United States,” Ms. Grossman said.

Yee told The Associated Press in a phone interview from jail this month that he feared returning to Singapore. But he said he’d continue to speak out and had already planned a line of T—shirts and started writing a book about his experiences.

“I have an infinite amount of ideas of what to do,” he told the AP.

Department of Homeland Security attorneys had opposed the asylum bid, saying Yee’s case didn’t qualify as persecution based on political beliefs. It was unclear whether they’d appeal the decision or if Yee would have to remain imprisoned if they did. Attorneys have 30 days to appeal.