BEIJING — One of China’s most prominent civil rights lawyers went on trial on Monday for seven online posts he made on a Twitter-like service, in the latest attempt by the Communist Party to silence political dissent and rein in activist lawyers who question official policies and actions.

The trial of the lawyer, Pu Zhiqiang, 50, drew widespread condemnation, including from foreign governments that sent diplomats to the courthouse in central Beijing to try to observe the proceedings. Lawyers for Mr. Pu said he could be sentenced to eight years in prison if found guilty on two speech-related charges. Mr. Pu’s supporters say the case against him is purely political.

No foreign officials or journalists were allowed into the courtroom on Monday morning, though Mr. Pu’s wife sat inside. The session began at 9 a.m. and lasted more than three hours.

“It was smooth and regulated,” Mo Shaoping, a lawyer for Mr. Pu, said, adding that he expected the verdict to be delivered soon. In such cases, senior officials, not the judges, generally decide the verdict and sentence.