It’s the latest iteration of a dynamic that has played out over the three years that Trump has managed America’s relationship with China. Armed with the conflicting views of his closest advisers, the president has regularly flip-flopped between lavishing praise on China and its leader, Xi Jinping, and lashing out at the country over trade practices.

Now, Trump is in a new fight with China over the narrative about the coronavirus pandemic that is racing around the world and stalling economies. It’s a battle that could help the president as he runs for reelection amid criticism that his administration's sluggish coronavirus response led to a shortage of tests and medical supplies. Even as Trump equivocates, his campaign, amplified by conservative groups and Trump allies, have gone after China.

“America is under attack — not just by an invisible virus, but by the Chinese,” the Trump campaign wrote in a recent email.

Trump allies said the president’s vacillation is how he manages a rival power.

“He’s being strategic,” said an outside adviser. “China is a clear foe. He builds them up to tear them down. The criticism plays zero role.”

“Carrot and the stick,” said Kelly Sadler, a former White House staffer who now works at America First Policies, which supports Trump’s agenda. “It's a pull-and-a-push relationship with China. President Trump has always been very complimentary to President Xi and the Chinese people. He's also been very tough in standing up for Americans by calling out China's unfair trade practices and taking them to task with tariffs.”

Most recently, Trump has been using the carrot, backing away from the term “Chinese virus” on Monday night. The shift came amid reports of a rise in racist and xenophobic behavior toward Asian Americans. It also came after a top Chinese official said his government shouldn’t push a conspiracy theory that coronavirus had come from the U.S.

But the Trump administration more broadly has not let up on its blame-China message. The State Department on Wednesday pushed to include the phrase “Wuhan virus” — a reference to the Chinese city where the coronavirus originated — in a joint statement from the Group of Seven countries.

And, as always, China could soon find itself back in Trump’s cross-hairs as media reports emerge that officials are once again suppressing case totals and refusing to test patients to preserve the narrative that they are past the worst of the coronavirus outbreak.

The White House and the office of Vice President Mike Pence, which heads the coronavirus task force, did not respond to a request for comment.

Ryan Hass, the Obama-era National Security Council’s director for China, Taiwan and Mongolia, said Trump’s references to China are “often driven by political expediency.”

“When it is advantageous to praise Xi Jinping in order to elicit Xi’s support for trade or exports related issues President Trump will do that,” said Hass, now a fellow at the center-left Brookings Institution. “When it feels like the walls are closing in on criticism about the Trump administration’s response to Covid-19 then he will … seek to shift blame to China for their botched initial efforts to contain the effort in Wuhan.”

Trump constantly criticized China when he was on the campaign trail in 2016 pledging to beat the so-called enemy that cost the U.S. jobs, spied on U.S. businesses and stole U.S. technology.

But once Trump was sworn into office in 2017, he began to speak fondly about Xi, his “good friend,” describing their relationship as “extraordinary.”

Within the Trump administration, there are competing camps on China advising Trump.

Secretary of State Mike Pompeo and national security adviser Robert O’Brien are both hawkish voices, focused on the threat the country poses.

Others, including Treasury Secretary Steven Mnuchin and National Economic Council Director Larry Kudlow are more concerned about preserving the valuable economic relationship with the country. Some of Trump’s outside friends, including John Thornton, former president of investment bank Goldman Sachs, and Stephen Schwarzman, CEO of the global equity firm Blackstone Group, also fall into that camp.

Sometimes, however, Trump seems to ignore all of his aides and friends and just listen to Xi, the Chinese leader.

“He’s drawn to authoritarian leaders,” said Michael Green, an Asia specialist for the NSC during the George W. Bush administration.

In January, Trump was receiving information about the coronavirus from both his own intelligence agencies, as well as Xi. Publicly, Trump sided with Xi’s optimistic narrative over the more dire warnings of his intelligence officials, praising Xi and China more than a dozen times for their handling of the coronavirus.

“I’m confident that they’re trying very hard,” Trump told a Phoenix radio station on Feb. 19. “I know President Xi. I get along with him very well. We just made a great trade deal, which is going to be a lot of business for Arizona and every other place. But they are trying very, very hard, and I think the numbers are going to get progressively better as we go along.”

That started to change in March.

Those around Trump, including Pompeo, incoming chief of staff Mark Meadows, allies on Capitol Hill and conservatives on television, began calling the coronavirus the “Wuhan virus” or “Chinese virus.”

"There's been some discussion about China and what they knew and when they knew it,” Pompeo said. “The world is entitled to know.”

Initially, China struck back, with the country's foreign ministry spokesman saying the U.S. Army may have had a role in spreading the virus.

“It might be U.S. army who brought the epidemic to Wuhan,” Zhao Lijian tweeted. “Be transparent! Make public your data! US owe us an explanation!”

It was then that Trump adopted “Chinese virus.” A photographer from The Washington Post captured a photo of Trump’s notes from a news briefing last week showing the word “corona” crossed out in coronavirus and replaced with the word “Chinese.” The president shrugged off accusations that the term was inappropriately divisive and racially tinged.

The president’s outside allies swiftly adopted the posture.