Chinese President Xi Jinping during the opening ceremony for the 15th International Association of Athletics Federations World Athletics Championships in Beijing on Aug. 22. (Lintao Zhang/Getty Images for IAAF)

For more than six years, the Obama administration has tried to reassure China that there is enough room on the world stage for a strong United States and a rising China willing to play by established international rules.

The wisdom of that approach has been challenged repeatedly by China’s unfettered ambitions and questionable behavior, including its cyber-hacking, the construction of a military outpost in the South China Sea and the establishment of a controversial Asian investment bank.

While the U.S. posture has been focused on managing China’s peaceful rise, the recent economic turbulence in China is a reminder that slowing growth in the world’s second-largest economy may pose greater short-term risks to the United States — and President Obama’s legacy — by threatening to stall the U.S recovery and destabilize global stock and bond markets.

The current crisis is an apt illustration of why U.S. policy toward China is often such a tricky proposition: The United States needs a stable, successful China but fears what that success could mean for the balance of power between the two nations, at home and abroad.

The stock market tumult over the past several trading days has hit hardest at some of the companies most involved in China, including General Motors, Cisco and Apple. And it has inflamed a debate central to the U.S. presidential campaign, over jobs, middle-class wages and the widening income gap, with candidates in both parties seeking to capi­tal­ize on American workers’ anxiety over the effects of globalization.

Republican presidential hopeful Donald Trump reiterated his charges that weak policy had left the United States too dependent on China, and he said the U.S. economy is now paying the price. Sen. Bernie Sanders (I-Vt.), who is seeking the Democratic nomination, criticized U.S. trade policy and accused wealthy business leaders of “shipping our jobs to China.”

Wisconsin Gov. Scott Walker, another GOP presidential candidate, challenged Obama to show “some backbone” and take the unprecedented step of canceling Chinese President Xi Jinping’s first state visit to Washington next month. Walker cited a litany of disputes, including suspicions that China slashed the value of its currency this month in a desperate bid to boost flagging exports.

“Part of our problem right now is that they don’t respect us,” he said during a campaign appearance in Spartanburg, S.C. “This is sending a clear message that we expect better out of China.”

The escalating rhetoric has at times been contradictory — Is China beating the United States in a race for global preeminence or leading it in a downward spiral? — but it has put the White House on the defensive as Obama aides seek to temper the calls for a tougher stance against Beijing.

White House press secretary Josh Earnest pointed to recent statements from the Treasury Department warning Beijing against reversing steps it has taken toward overhauling its economy to be more responsive to the market, rather than tightly controlled government manipulation. But he declined to criticize Beijing directly and said Obama had not spoken with Xi in the wake of the market fluctuations.

If anything, Earnest used the market turbulence to prod Congress, calling on lawmakers to approve a budget, back an infrastructure investment program and authorize an extension of the Export-Import Bank. “The president is very mindful of how this would be a particularly bad time for a self-inflicted wound,” he said.

On Tuesday, the administration announced that national security adviser Susan E. Rice will travel to Beijing on Friday for a two-day trip to speak with senior officials ahead of Xi’s visit.

In an interview, Ruan Zongze, vice president of the China Institute of International Studies, a think tank affiliated with the Chinese Foreign Ministry, scoffed at the anti-China rhetoric on the campaign trail.

“For years, our American friends tell us this is a special season,” Ruan said. “This is American politics. I don’t make too much of it.”

He added that every four years American politicians running for the White house “want the benefits of criticizing and being tough on China. Turns out it’s not working.”

Americans, he said, “need to focus on the economy, job creation and many other basic things. On the contrary, China can be helpful for economic prosperity and job creation.”

During their summit, Obama and Xi are expected to celebrate their shared commitment to curtailing greenhouse gas emissions and the Iranian nuclear deal crafted by the United States, China and four other partners.

Yet on most other issues — human rights, military rivalry, territorial claims at sea, cyberwarfare and intellectual property — China and the United States are at odds. And now the economic instability in China threatens the Communist Party’s greatest achievement: an economy strong and stable enough to lift hundreds of millions of people out of poverty and provide an appealing, open market for foreign firms.

Xi has sought to shift China’s economy from overreliance on foreign investment to greater dependence on domestic consumption, but demand has lagged. Foreign-policy analysts said the nation’s economic woes and its emboldened strategic ambitions are interconnected as Xi, under pressure to maintain turbocharged growth, has aimed to expand China’s reach across Asia and create a new “Silk Road” of prosperity — and influence.

“The difficulty with China that played out with both the [George W.] Bush administration and now the Obama administration is the underlying question of, ‘What do we want them to do?’ ” said Philip Levy, who served as an economist on trade for Bush’s Council of Economic Advisers and advised Sen. John McCain (R-Ariz.) in his 2008 presidential bid. He is now advising Walker.

In the wake of the 2008 financial crisis, the Obama administration supported a major Chinese government stimulus program to prop up its economy, Levy noted, but that led to a rapid rise in domestic debt that now needs to be contained.

“The Chinese are now caught any way they turn,” Levy said. “Turn off the tap and say enough of this crazy lending and investment and spending that has led to overcapacity. Or veer back again and say banks are not required to hold as much in reserve” to further juice the credit bubble.

Over the past few months, China has chosen the latter course, and Xi has stepped back from many of the financial reform measures he initially supported. What remains is the new Silk Road plan — a big-ticket, government-financed infrastructure program similar to earlier economic balms.

“The problem has gotten blown out of proportion,” Levy added, “and we’re left with no appetizing choices — from their perspective or ours.”

To some degree, the power dynamic in the U.S.-China relationship has shifted from Obama’s first year in office, when the new president traveled to Beijing for a summit with then-President Hu Jintao, who felt emboldened by China’s rising stature at a time of U.S. recession.

This year, confident that the U.S. economy has stabilized, Obama successfully pushed legislation through Congress that grants him additional powers to complete an expansive 12-nation Pacific Rim trade accord to counter China’s growing influence. China is not involved in that deal, and Beijing has responded by launching the regional Asian Infrastructure Investment Bank, backed by contributions from U.S. allies, including Britain, Germany and South Korea.

White House allies said the administration should resist outside calls for a zero-sum contest with China, even amid the mounting signs that the Communist Party is willing to undermine its own economic reform measures to maintain control.

“What we need from China is a more balanced approach to growth,” said Jared Bernstein, who served as Vice President Biden’s chief economic adviser from 2009 to 2011. “The mercantilist export model certainly is not working for us; its effectiveness is limited for them.”