Just when it seemed Hu Jintao’s record as China’s president couldn’t look any worse, Kim Jong Un adds another black mark to his legacy.

Last week’s dramatic execution of Kim’s uncle and No. 2 -- the China-friendly Jang Song Thaek -- has many people looking to see how Beijing reacts. China is Kim’s main benefactor and, despite protestations to the contrary, the only government with real leverage over North Korea’s leader. In the weeks to come, current President Xi Jinping should do all he can to wield that power to rein in the vindictive, unpredictable Kim -- for the good of China, let alone the rest of us.

If that seems like a tall challenge, Xi can thank his predecessor for making it taller. The time to alter North Korea’s ruinous direction came in December 2011, when Kim succeeded his father Kim Jong Il, who died two years ago today.

At the time, Kim the younger was an untested 20-something - - a callow, Swiss-educated Michael Jordan fan at the top of the world’s most repressive regime. He was at his most vulnerable: Jang, in fact, served him as regent to guide the young leader through the thickets of Pyongyang politics. That’s when Beijing should have reached out, using both carrots and sticks to encourage Kim to set his country on a new trajectory.

Hu could have picked up the phone and said: Look, your country has gotten about as far as it can by blackmailing the world for food and financial support. We live in an age of GPS tracking systems and military drones, which makes your favored businesses such as missile sales and counterfeiting hard to sustain. Printing fake $100 bills and making weapons is easy; transporting them in sufficient quantity isn’t. Why not learn from China’s success in creating industries and raising people out of poverty? Don’t worry about that democracy stuff. We can show you how to stay in power.

Chinese leaders say they’ve repeatedly made all these arguments to the North Koreans. Indeed, Jang himself was associated with Chinese-style economic innovations such as the series of special-economic zones planned in North Korea.

But under Hu, China put no teeth in its message. Instead, Beijing looked the other way as a new Kim drove the nation even further into the ground and ratcheted up global tensions with nuclear tests, missile launches and fiery rhetoric. Hu, like Chinese leaders before him, favored the status quo, believing China gained more from Pyongyang keeping the U.S., Japan and South Korea off balance than from taming the Kim cabal. In doing so, Beijing missed a once-in-several-decades window of opportunity.

China can’t exactly control Pyongyang. But Kim’s sugar daddy can always cut off his allowance. You want food aid and fuel? Then here are a few things you need to do in return for Chinese support: Transform your 17th-century economy and let our experts help upgrade your agricultural and manufacturing methods; calm down with the nuclear tests; and do a bit better by your people to avoid a huge uprising and chaos on our northeast border.

The execution of Jang suggests that Kim is instead digging in his heels. Where does all this leave Xi? For starters, he’s at a serious disadvantage now that the most pro-China, pro-economic-reform voice in Kim’s inner circle has been taken out, blitzkrieg-style. “Their hope all along was to persuade the North Koreans to reform and open,” says Bradley Martin, author of the book “Under the Loving Care of the Fatherly Leader.” “With Jang dead, who in Pyongyang is going to argue for that now? Anyone who does is automatically part of Jang’s conspiracy and probably in receipt of Chinese kickbacks, by definition.”

Still, this is an obvious chance for Xi to assert himself. China’s rise comes with commensurate responsibility. Xi claims his country is a force for peace, cooperation and stability in the region. This is an opportunity to prove it. Xi should go much further to back United Nations sanctions against Pyongyang. He should make public statements criticizing Kim’s recalcitrance and backchannel threats that are much stronger than before.

Sure, Kim will be upset, and he may threaten to lash out. But where has enabling him gotten China? The longer Beijing looks the other way, the faster Pyongyang hurtles toward the collapse scenario that so frightens the Communist Party.

Think of the geopolitical points China would score by being a good global citizen -- a responsible stakeholder, in the parlance of diplomats. At home, too: China’s blogosphere is pulsating with debate about the wisdom of supporting Kim.

Tamping down risks on the Korean peninsula would help win China the bigger say it craves at the International Monetary Fund, Asian Development Bank and other global institutions. North Korea’s stability is indeed critical to China’s rise -- just not in the way leaders like Hu and Xi seem to think.

(William Pesek is a Bloomberg View columnist.)

To contact the writer of this article: William Pesek in Tokyo at wpesek@bloomberg.net.

To contact the editor responsible for this article: Nisid Hajari at nhajari@bloomberg.net.