BEIJING — In a photograph on his lawyer’s Web site, Ma Yaohai stares straight at the camera, cheekbones prominent above sunken cheeks, his expression intense, almost haunted. The 53-year-old computer scientist, dressed soberly in a dark jacket and polo-neck pullover, holds a sign saying: “Swinging is no crime.”

Unfortunately for Mr. Ma, it is. Article 301 of China’s criminal law bans “crowd promiscuity,” with offenders liable to five years in jail.

On April 7, Mr. Ma and 21 other members of his swingers’ circle were tried in the central city of Nanjing on group sex charges, in a case that is roiling society and provoking heated debates in academic circles, among friends and in the blogosphere. Prosecutors accuse the twice-divorced Mr. Ma, who has since been fired from his job as a professor at Nanjing University of Technology, of organizing and taking part in at least 18 group sex parties between 2007 and 2009. Fourteen were in his own home, four in hotels and the rest in unspecified locations, according to his lawyer, Xue Huogen.

No verdict has yet emerged from the two-day trial, during which Mr. Ma was the only defendant to plead not guilty.