HONG KONG’s election of a new chief executive Sunday was a mess — a travesty in which the 1,132 handpicked voters were outnumbered by demonstrators who were kept away from the assembly with pepper spray. The winner, Leung Chun-ying, was muscled through by pressure from Beijing despite his unpopularity with the local business elite. As for the general population, an online poll in which 220,000 people took part recorded 54 percent for none of the candidates, followed by 17 percent for Mr. Leung.

Mr. Leung found a way to alienate almost everyone in Hong Kong. His populist economic agenda, including promises to construct public housing, upset real estate tycoons. More average citizens, increasingly restless under a regime that allows free speech and assembly but not free elections, were repelled by allegations that Mr. Leung was a secret member of the Chinese Communist Party or had favored the repression by force of mass demonstrations in 2003. His denials failed to staunch the controversies.

Mr. Leung benefited from the mud slung at his chief opponent, Henry Tang Ying-yen, who was forced to admit to adultery as well as to the illegal construction of a 2,000-square-foot basement in one of his homes. Initially favored by some in the mainland Chinese leadership, Mr. Tang was jettisoned in the days before the election as Beijing not-so-subtly threw its weight behind Mr. Leung. The only representative of the pro-democracy opposition in the campaign was never given a chance.

In the end, the election served only to underline the unsustainability of China’s attempt to limit the democracy it promised to Hong Kong. In a televised debate, both leading candidates promised to support mass suffrage in the next election for executive five years from now. Mr. Leung used his first news conference to promise he would not compromise existing freedoms.

As awkward as it is, Hong Kong’s political transition looks smooth and transparent compared to that underway in Beijing, where the ascension of a new president and replacement of seven of the nine top Communist Party leaders appear to have touched off a muffled but intense power struggle. Another small piece of that puzzle came into view over the weekend when the British government announced that it had asked for further investigation of the death of a British businessman in the city of Chongqing. The Wall Street Journal reported that the mysterious case may have played a role in the purge of the city’s top leader and the attempted defection of his deputy at a U.S. consulate.

In Hong Kong, citizens can see and hear the competition for political leadership but not participate in it; mainland Chinese, like the outside world, are mostly in the dark about the sides and the stakes in the fight for power. In both places, the system is showing signs of cracking. The sooner it does so, the better for the Chinese people.