WASHINGTON — Step by step, blow by blow, the United States and China are dismantling decades of political, economic and social engagement, setting the stage for a new era of confrontation shaped by the views of the most hawkish voices on both sides.With President Trump trailing badly in the polls as the election nears, his national security officials have intensified their attack on China in recent weeks, targeting its officials, diplomats and executives. While the strategy has reinforced a key campaign message, some American officials, worried Mr. Trump will lose, are also trying to engineer irreversible changes, according to people familiar with the thinking.China’s leader, Xi Jinping, has inflamed the fight, brushing aside international concern about the country’s rising authoritarianism to consolidate his own political power and to crack down on basic freedoms, from Xinjiang to Hong Kong. By doing so, he has hardened attitudes in Washington, fueling a clash that at least some in China believe could be dangerous to the country’s interests.The combined effect could prove to be Mr. Trump’s most consequential foreign policy legacy, even if it’s not one he has consistently pursued: the entrenchment of a fundamental strategic and ideological confrontation between the world’s two largest economies.A state of broad and intense competition is the end goal of the president’s hawkish advisers. In their view, confrontation and coercion, aggression and antagonism should be the status quo with the Chinese Communist Party, no matter who is leading the United States next year. They call it “reciprocity.”Secretary of State Mike Pompeo declared in a speech on Thursday that the relationship should be based on the principle of “distrust and verify,” saying that the diplomatic opening orchestrated by President Richard M. Nixon nearly half a century ago had ultimately undermined American interests.“We must admit a hard truth that should guide us in the years and decades to come: that if we want to have a free 21st century, and not the Chinese century of which Xi Jinping dreams, the old paradigm of blind engagement with China simply won’t get it done,” Mr. Pompeo said. “We must not continue it and we must not return to it.”The events of the last week brought relations to yet another low, accelerating the downward spiral.On Tuesday, the State Department ordered China to shut down its Houston consulate, prompting diplomats there to burn documents in a courtyard. On Friday, in retaliation, China ordered the United States to close its consulate in the southwestern city of Chengdu. The Chinese Foreign Ministry the next day denounced what it called “forced entry” into the Houston consulate by U.S. law enforcement officers on Friday afternoon.In between, the Department of Justice announced criminal charges against four members of the People’s Liberation Army for lying about their status in order to operate as undercover intelligence operatives in the United States. All four have been arrested. One, Tang Juan, who was studying at the University of California, Davis, ignited a diplomatic standoff when she sought refuge in the Chinese consulate in San Francisco, but was taken into custody on Thursday night.This comes on top of a month in which the administration announced sanctions on senior Chinese officials, including a member of the ruling Politburo, over the mass internment of Muslims; revoked the special status of Hong Kong in diplomatic and trade relations; and declared that China’s vast maritime claims in the South China Sea were illegal.The administration has also imposed a travel ban on Chinese students at graduate level or higher with ties to military institutions in China. Officials are discussing whether to do the same to members of the Communist Party and their families, a sweeping move that could put 270 million people on a blacklist.“Below the president, Secretary Pompeo and other members of the administration appear to have broader goals,” said Ryan Hass, a China director on President Barack Obama’s National Security Council who is now at the Brookings Institution.“They want to reorient the U.S.-China relationship toward an all-encompassing systemic rivalry that cannot be reversed by the outcome of the upcoming U.S. election,” he said. “They believe this reorientation is needed to put the United States on a competitive footing against its 21st-century geostrategic rival.”From the start, Mr. Trump has vowed to change the relationship with China, but mainly when it comes to trade. Early this year, the negotiated truce in the countries’ trade war was hailed by some aides as a signature accomplishment. That deal is still in effect, though hanging by a thread, overshadowed by the broader fight.Beyond China, few of the administration’s foreign policy goals have been fully achieved. Mr. Trump’s personal diplomacy with Kim Jong-un, the North Korean leader, has done nothing to end the country’s nuclear weapons program.His withdrawal from the Iran nuclear deal has further alienated allies and made that country’s leaders even more belligerent. His effort to change the government in Venezuela failed. His promised withdrawal of all American troops from Afghanistan has yet to occur.In Beijing, some officials and analysts have publicly dismissed many of the Trump administration’s moves as campaign politics, accusing Mr. Pompeo and others of promoting a Cold War mentality to score points for an uphill re-election fight. There is a growing recognition, though, that the conflict’s roots run deeper.The breadth of the administration’s campaign has vindicated those in China — and possibly Mr. Xi himself — who have long suspected that the United States will never accept the country’s growing economic and military might, or its authoritarian political system.“It’s not just electoral considerations,” said Cheng Xiaohe, an associate professor at the School of International Studies at Renmin University in Beijing. “It is also a natural escalation and a result of the inherent contradictions between China and the United States.”Already reeling from the coronavirus pandemic, some Chinese officials have sought to avoid open conflict with the United States. They have urged the Trump administration to reconsider each of its actions and called for cooperation, not confrontation, albeit without offering significant concessions of their own.“With global anti-China sentiment at its highest level in decades, Chinese officials have indicated an interest in exploring potential offramps to the current death spiral in U.S.-China relations,” said Jessica Chen Weiss, a political scientist at Cornell University who studies Chinese foreign policy and public opinion.“Beijing isn’t spoiling for an all-out fight with the United States,” she said, “but at a minimum the Chinese government will retaliate to show the world — and a prospective Biden administration — that China won’t be intimidated or pushed around.”Given the size of each nation’s economy and their entwinement, there are limits to the unwinding of relations, or what some Trump officials call “decoupling.” In the United States, tycoons and business executives, who exercise enormous sway among politicians of both parties, will continue to push for a more moderate approach, as members of Mr. Trump’s cabinet who represent Wall Street interests have done. China is making leaps in science, technology and education that Americans and citizens of other Western nations will want to share in. In his Thursday speech, even Mr. Pompeo acknowledged, “China is deeply integrated into the global economy.”Only two weeks ago, the foreign minister, Wang Yi, called on the United States to step back from confrontation and work with China. In reality, officials in Beijing appear resigned to the likelihood that nothing will change for the better before next year.“There is very little China can do to take the initiative,” said Wu Qiang, an independent analyst in Beijing. “It has very few proactive options.”Mr. Trump whipsaws in his language on China. He has called Mr. Xi “a very, very good friend” and even privately encouraged him to keep building mass internment camps for Muslims and handle the Hong Kong pro-democracy protesters his way, according to a new book by John R. Bolton, the former national security adviser. When he last spoke with Mr. Xi, he expressed “much respect!” on Twitter. With the election looming, Mr. Trump’s tone has changed. He has returned to bashing China, as he did in 2016, blaming Beijing for the pandemic and even referring to the coronavirus with a racist phrase, “Kung Flu.” His campaign aides have made aggressive rhetoric on China a pillar of their strategy, believing it could help energize voters.The heated language, combined with the administration’s policy actions, could actually be having a galvanizing effect on Chinese citizens, some analysts and political figures in Beijing say.“I strongly urge American people to re-elect Trump because his team has many crazy members like Pompeo,” Hu Xijin, the editor of the nationalist newspaper Global Times, wrote on Twitter on Friday. “They help China strengthen solidarity and cohesion in a special way.”The relationship might not change course even if former Vice President Joseph R. Biden Jr. defeats Mr. Trump in November. The idea of orienting American policy toward competition with China has had robust bipartisan support over the last three-and-a-half years.The Chinese government’s initial mishandling of the coronavirus outbreak and its actions in Hong Kong, which is widely seen as a beacon of liberal values within China, have been signal moments this year, contributing to the tectonic shift in views across the political spectrum.The China hawks in the administration have seized on them to publicly push their perspective: that the Chinese Communist Party seeks to expand its ideology and authoritarian vision worldwide, and that citizens of liberal nations must wake up to the dangers and gird themselves for a conflict that could last for decades.Since late June, the administration has rolled out four top officials to make that case.Attorney General William P. Barr accused American companies of “corporate appeasement,” while Christopher Wray, the F.B.I. director, said his agency was opening a new China-related counterintelligence investigation every 10 hours.Mr. Trump’s national security adviser, Robert O’Brien, warned that the Chinese Communist Party aimed to remake the world in its image. “The effort to control thought beyond the borders of China is well underway,” he said.Mr. Pompeo’s speech on Thursday was meant as the punctuation mark. He chose the presidential library of the man credited with opening up U.S.-China relations to declare the policy a failure.“President Nixon once said he feared he had created a ‘Frankenstein’ by opening the world to the C.C.P.,” Mr. Pompeo said, referring to the Chinese Communist Party, “and here we are.”Edward Wong reported from Washington, and Steven Lee Myers from Seoul, South Korea. Claire Fu contributed research from Beijing.