The heavy sentences for the relatively obscure activists came after a trial in September in which prosecutors dwelt on essays by the men that were published on overseas Chinese websites and on their support for the China Democratic Party, a small but determined group that a wave of arrests and trials in the late 1990s largely extinguished.

Their defense lawyers challenged the view that these activities amounted to subversion, one of the most serious charges that can be used against political dissent in the country.

Patrick Poon, a researcher on China for Amnesty International in Hong Kong, said the rulings indicated that President Xi Jinping was even more determined than his predecessors, including most recently Hu Jintao, to stamp out anti-Communist sentiment.

“My take is that the sentence is unusually heavy,” Mr. Poon said by email. “These two people were also imprisoned for similar charges during the Hu Jintao era, but they were only sentenced to four years at that time.”

The punishments may also send a warning to other dissidents and liberal activists around Hangzhou, the prosperous capital of Zhejiang Province, which will hold the Group of 20 summit meeting of global leaders in early September. The city, like the Chinese government, has gone to great lengths to make the gathering a showcase for the success of government policies.