Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A blogger from Singapore who was jailed for his online posts blasting his government was granted asylum to remain in the United States, an immigration judge ruled.

Amos Yee, 18, has been detained by 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 center as early as Monday.

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

Singapore teen blogger Amos Yee has been granted asylum in U.S. (File Image) Wong Maye-E / AP

"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," Cole wrote.

Yee left Singapore with the intention of seeking asylum in the U.S. after being jailed for several weeks in 2015 and 2016. He was accused of hurting the religious feelings of Muslims and Christians in the multiethnic city-state. Yee is an atheist.

Many of his blog and social media posts criticized 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 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.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

"Yee has met his burden of showing that he suffered past persecution."

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.

Singapore's government criticized the decision.

"Yee had engaged in hate speech against Christians and Muslims. The U.S. adopts a different standard, and allows such hate speech under the rubric of freedom of speech," the Ministry of Home Affairs said in a statement Saturday.

"It is the prerogative of the U.S. to take in such people who engage in hate speech," the ministry said. "There are many more such people around the world who deliberately engage in hate speech, and who may be prosecuted. Some of them will no doubt take note of the U.S. approach, and consider applying for asylum in the U.S."

Related: Hacker ‘Bunnie’ Huang Is Challenging the Government

The ruling was praised by others.

"I think this is a major embarrassment for the government, that all along claimed Amos' persecution was not political," Kenneth Jeyaretnam, an opposition politician who gave testimony supporting Yee's asylum, told The Associated Press.

Jeyaretnam said the decision "may create waves in Singapore. It may show Singaporeans that there's nothing to be afraid about. The Singapore government is a paper tiger. We don't have to swallow the brainwashing that is constantly put out."

His father, the late J.B. Jeyaretnam, attained folklore stature in the country's politics and was bankrupted after contesting a series of lawsuits by the ruling People's Action Party.

The party has dominated national politics since Singapore's independence in 1965 and its detractors often were taken to court on defamation or other charges.

U.S.-based Human Rights Watch applauded the asylum decision.

"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," said a statement from Phil Robertson, Human Rights Watch deputy Asia director.

Yee's attorney Sandra Grossman said her client was elated.

"He's very excited to begin new life in the United States," Grossman said.