Like Mel Brooks as the king of France, it’s good to be Xi Jinping. Or so you might think. The man is the undisputed ruler of the world’s most populous nation, the autocrat at the top of a one-party state that controls the second-largest economy in the world. His nation’s principal rival for global influence appears to have given up on statecraft in favor of government by temper tantrum.

But life’s getting tougher for the chairman, or so it seems from here. Xi has set for China the goal of becoming the most powerful nation on Earth. But that entails learning to employ tools of power that aren’t yet on his belt.

I’m talking about soft power — the use of international organizations, moral suasion, foreign aid, trade, compromise, alliances and salesmanship to achieve a nation’s aims. Brutally adept with hard power — from tanks and machine guns to concentration camps and starvation — the Chinese Communist Party has little experience with soft power. Xi is getting a crash course, with one test after another.

Hong Kong is the most immediate. More than 20 years after the former British colony was returned to Chinese sovereignty, the proud and wealthy city refuses to submit to Communist control. A law that would allow Beijing authorities to extradite dissidents from Hong Kong provoked a backlash of protest that grows larger with each effort to quell it. Close to 2 million people, according to organizers, participated in a peaceful demonstration on Sunday — arguably the biggest challenge to party authority since the 1989 student protest in Beijing, which ended in a massacre.

Though members of a Chinese paramilitary police force are massing on ground adjacent to Hong Kong, use of hard power to end the protests would be a serious mistake. The integration of Hong Kong is not a discrete exercise for China. Rather, it is the first test of China’s ability to exert decisive influence with its neighbors. Other nations of Asia, Europe and Africa are unlikely to welcome Chinese outreach if they know that Beijing’s only response to disagreement is violence.

There’s also the internal question. China’s tremendous economic growth in the 30 years since Tiananmen Square has created tens of millions of rich and middle-class individuals. Would the wealthy and worldly citizens of Shanghai, for example, acquiesce in the violent oppression of Hong Kong? Ditto Beijing, Guangzhou, Shenzhen and other newly rich cities. China’s strategy to reabsorb capitalist Taiwan peacefully someday would suffer a terrible blow if the Hong Kong experiment were to fail.

No nation is ready for global power that can’t amicably coexist with a wealthy city under its control. The extradition law was a massive blunder by a domestic tyrant and demands a skillful, soft-power solution.

Xi’s finesse is also being tested in western China, where overreliance on hard power has created an archipelago of concentration camps housing more than 1 million Uighur men, women and children. China’s oppression of this Muslim minority surely encouraged Indian Prime Minister Narendra Modi’s government in revoking the special status of the nearby disputed territory of Kashmir and embarking on a Muslim oppression of his own.

It is difficult to see how an emboldened and unquiet India is anything but bad for China’s long-term ambitions. The two mega-nations are natural rivals, but it is better to compete with a peaceful and law-abiding neighbor than with a reckless and belligerent one. A leader adept at soft power would set that example.

Finally, Xi faces a test regarding President Trump.

Whatever one thinks of Trump’s trade-war goals, his tactics appear to have left him at Xi’s mercy. The Chinese people — 60 percent of whom spend less than $10 a day — are far more accustomed to economic pain than Trump’s Americans, and they have no meaningful right to vote. So Xi can probably afford to absorb the economic pain necessary to push the trade war past Election Day. This would greatly increase the chance of a recession in 2020 and damage the American president’s chance of reelection.

On the other hand, Xi also has the power to make a few token concessions that would allow Trump to claim victory in the trade war. Markets would give a hearty cheer; Trump would crown himself the China slayer. But Xi might gain four more years of severe disruption in the West.

The hard-power choice here is probably to stay the course on trade negotiations, spreading the pain unevenly and disproportionately on China’s impoverished majority. In the People’s Republic, it’s always the people who suffer. Confronting a U.S. president and potentially ending his career would ratify China’s arrival at superpower status.

Yet Xi may stand to gain more from the soft-power play, graciously springing Trump from the trap he stepped in. Trump’s reelection would gratify his supporters and demoralize everyone else, further depleting the soft power of the United States. It’s shocking that a U.S. president has given such juicy options to the Chinese leader. We’ll learn how canny Xi is by the choice he makes.

Read more: