A U.S. immigration judge in Chicago on Friday granted asylum to a Singaporean blogger, saying he was persecuted for his political opinions in the Southeast Asian city-state.

Amos Yee, 18, who had been jailed twice in Singapore, qualifies as a political refugee, according to a 13-page opinion by the U.S. immigration judge.

Yee is immediately eligible for release after having been held in U.S. immigration detention since Dec. 16, 2016, according to his attorney, Sandra Grossman, who is based in Bethesda, Maryland.

The Singapore Embassy in Washington could not be reached for comment after business hours on Friday evening.

Judge Samuel Cole ruled Yee's prosecution, detention and maltreatment at the hands of the Singapore authorities "constitute(s) persecution on account of Yee's political opinions," and called him a "young political dissident.

"The evidence presented at the hearing demonstrates Singapore's prosecution of Yee was a pretext to silence his political opinions critical of the Singapore government," Cole wrote.

The U.S. Department of Homeland Security had opposed Yee's asylum application, claiming the Singapore government legitimately prosecuted Yee.

Grossman said the judge's decision supported the right of individuals to criticise their government.

"The right to free speech is sacred, even when such speech is considered offensive," she said in an email. "The decision timely underscores the vital need for an independent judiciary in a functioning democracy."

Yee had been held by U.S. authorities since arriving at Chicago's O'Hare International Airport, seeking political asylum. He was initially detained in Illinois, but is now being held at the Dodge County Detention Facility in Juneau, Wisconsin, Grossman said.

Yee has been jailed twice in Singapore for online comments. His trials, which have been closely watched by rights groups and the United Nations, have fuelled the debate in Singapore over censorship, the limits of free speech and political correctness.

In September of last year, Yee pleaded guilty to six charges of deliberately posting comments on the internet - in videos, blog posts and a picture - that were critical of Christianity and Islam. He was sentenced to six weeks in jail.

In 2015, Yee was convicted on charges of harassment and insulting a religious group over comments he made about former premier Lee Kuan Yew and Christians soon after Lee's death. His sentence at the time amounted to four weeks in jail.