In a speech to Communist Party officials last January 20th, Major General Jin Yinan, a strategist at China’s National Defense University, celebrated America’s pullout from the trade deal. “We are quiet about it,” he said. “We repeatedly state that Trump ‘harms China.’ We want to keep it that way. In fact, he has given China a huge gift. That is the American withdrawal from T.P.P.” Jin, whose remarks later circulated, told his audience, “As the U.S. retreats globally, China shows up.”

For years, China’s leaders predicted that a time would come—perhaps midway through this century—when it could project its own values abroad. In the age of “America First,” that time has come far sooner than expected.

Barack Obama’s foreign policy was characterized as leading from behind. Trump’s doctrine may come to be understood as retreating from the front. Trump has severed American commitments that he considers risky, costly, or politically unappealing. In his first week in office, he tried to ban travellers from seven Muslim-majority countries, arguing that they pose a terrorist threat. (After court battles, a version of the ban took effect in December.) He announced his intention to withdraw the U.S. from the Paris Agreement on climate change and from UNESCO, and he abandoned United Nations talks on migration. He has said that he might renege on the Iran nuclear deal, a free-trade agreement with South Korea, and NAFTA. His proposal for the 2018 budget would cut foreign assistance by forty-two per cent, or $11.5 billion, and it reduces American funding for development projects, such as those financed by the World Bank. In December, Trump threatened to cut off aid to any country that supports a resolution condemning his decision to recognize Jerusalem as the capital of Israel. (The next day, in defiance of Trump’s threat, the resolution passed overwhelmingly.)

To frame his vision of a smaller presence abroad, Trump often portrays America’s urgent task as one of survival. As he put it during the campaign, “At what point do you say, ‘Hey, we have to take care of ourselves’? So, you know, I know the outer world exists and I’ll be very cognizant of that, but, at the same time, our country is disintegrating.”

So far, Trump has proposed reducing U.S. contributions to the U.N. by forty per cent, and pressured the General Assembly to cut six hundred million dollars from its peacekeeping budget. In his first speech to the U.N., in September, Trump ignored its collective spirit and celebrated sovereignty above all, saying, “As President of the United States, I will always put America first, just like you, as the leaders of your countries, will always and should always put your countries first.”

China’s approach is more ambitious. In recent years, it has taken steps to accrue national power on a scale that no country has attempted since the Cold War, by increasing its investments in the types of assets that established American authority in the previous century: foreign aid, overseas security, foreign influence, and the most advanced new technologies, such as artificial intelligence. It has become one of the leading contributors to the U.N.’s budget and to its peacekeeping force, and it has joined talks to address global problems such as terrorism, piracy, and nuclear proliferation.

And China has embarked on history’s most expensive foreign infrastructure plan. Under the Belt and Road Initiative, it is building bridges, railways, and ports in Asia, Africa, and beyond. If the initiative’s cost reaches a trillion dollars, as predicted, it will be more than seven times that of the Marshall Plan, which the U.S. launched in 1947, spending a hundred and thirty billion, in today’s dollars, on rebuilding postwar Europe.

China is also seizing immediate opportunities presented by Trump. Days before the T.P.P. withdrawal, President Xi Jinping spoke at the World Economic Forum, in Davos, Switzerland, a first for a paramount Chinese leader. Xi reiterated his support for the Paris climate deal and compared protectionism to “locking oneself in a dark room.” He said, “No one will emerge as a winner in a trade war.” This was an ironic performance—for decades, China has relied on protectionism—but Trump provided an irresistible opening. China is negotiating with at least sixteen countries to form the Regional Comprehensive Economic Partnership, a free-trade zone that excludes the United States, which it proposed in 2012 as a response to the T.P.P. If the deal is signed next year, as projected, it will create the world’s largest trade bloc, by population.

Some of China’s growing sway is unseen by the public. In October, the World Trade Organization convened ministers from nearly forty countries in Marrakech, Morocco, for the kind of routine diplomatic session that updates rules on trade in agriculture and seafood. The Trump Administration, which has been critical of the W.T.O., sent an official who delivered a speech and departed early. “For two days of meetings, there were no Americans,” a former U.S. official told me. “And the Chinese were going into every session and chortling about how they were now guarantors of the trading system.”

By setting more of the world’s rules, China hopes to “break the Western moral advantage,” which identifies “good and bad” political systems, as Li Ziguo, at the China Institute of International Studies, has said. In November, 2016, Meng Hongwei, a Chinese vice-minister of public security, became the first Chinese president of Interpol, the international police organization; the move alarmed human-rights groups, because Interpol has been criticized for helping authoritarian governments target and harass dissidents and pro-democracy activists abroad.

By some measures, the U.S. will remain dominant for years to come. It has at least twelve aircraft carriers. China has two. The U.S. has collective defense treaties with more than fifty countries. China has one, with North Korea. Moreover, China’s economic path is complicated by heavy debts, bloated state-owned enterprises, rising inequality, and slowing growth. The workers who once powered China’s boom are graying. China’s air, water, and soil are disastrously polluted.

And yet the gap has narrowed. In 2000, the U.S. accounted for thirty-one per cent of the global economy, and China accounted for four per cent. Today, the U.S.’s share is twenty-four per cent and China’s fifteen per cent. If its economy surpasses America’s in size, as experts predict, it will be the first time in more than a century that the world’s largest economy belongs to a non-democratic country. At that point, China will play a larger role in shaping, or thwarting, values such as competitive elections, freedom of expression, and an open Internet. Already, the world has less confidence in America than we might guess. Last year, the Pew Research Center asked people in thirty-seven countries which leader would do the right thing when it came to world affairs. They chose Xi Jinping over Donald Trump, twenty-eight per cent to twenty-two per cent.

Facing criticism for his lack of interest in global leadership, Trump, in December, issued a national-security strategy that singled out China and Russia and declared, “We will raise our competitive game to meet that challenge, to protect American interests, and to advance our values.” But, in his speech unveiling the strategy, he hailed his pullout from “job-killing deals such as the Trans-Pacific Partnership and the very expensive and unfair Paris climate accord.” The next day, Roger Cohen, of the Times, described the contradictions of Trump’s foreign policy as a “farce.” Some allies have taken to avoiding the Administration. “I’ll tell you, honestly, for a foreigner, in the past we were used to going to the White House to get our work done,” Shivshankar Menon, India’s former foreign secretary and national-security adviser to the Prime Minister, told me. “Now we go to the corporations, to Congress, to the Pentagon, wherever.”