A prominent Chinese lawyer is expected to be freed after a Beijing court on Tuesday gave him a suspended jail sentence after finding him guilty in a case involving online comments critical of the ruling Communist Party.

The court said Pu Zhiqiang was guilty of provoking troubles and inciting ethnic hatred, and sentenced him to three years in prison but also announced that the sentence will be suspended for three years.

The sentence came as good news to Pu's supporters, who believe the case has been politically driven to punish the outspoken lawyer who has become a leading figure among China's rights defense lawyers.

Pu was active in defending free speech and represented artist Ai Weiwei in a tax evasion case that Ai's supporters said was politically motivated. He also was instrumental in pushing for the eventual abolishment of the labor camp system, which allowed police to lock up people for up to four years without a trial.

Since coming to power in 2013, Chinese President Xi Jinping has spearheaded crackdowns on civil activists, rights lawyers and online freedom of expression, in moves aimed at snuffing out any potential threats to the Communist Party's grip on power.

Pu was detained shortly after attending a May 2014 meeting to discuss commemorating 25 years since the Tiananmen Square massacre, at a time when authorities were keeping a lid on any public commemorations of the event. Hundreds, possibly thousands, of protesters were killed in the crackdown, and the topic remains taboo in China.

After a prolonged investigation, Pu stood trial on Dec. 14 for his online comments that questioned Beijing's ethnic policies and poked fun at some political figures.

The case drew wide attention from human rights groups and foreign governments, including Washington, who demanded that Pu be released. Legal rights advocates had argued that Pu was entitled to the speech and that his case would test China's pledge to rule in accordance of the law.

On Tuesday, hundreds of police blocked foreign journalists from approaching the court. Members of foreign embassies were barred from entering the court on the grounds that the courtroom was full.

At least one supporter who rallied outside the court was hauled away by police.

After the verdict came out, Pu's supporters said the lawyer should have been found innocent but added they were pleased that he will be freed. They said the suspended sentence is a face-saving move by the authorities.