Six months ago, the Chinese walked away from the trade negotiations.

The move caught nearly everyone by surprise.

After all, the talks had been going on, with increasing intensity, almost since President Trump took office. And they had made significant progress by early 2019.

By March the draft trade agreement had reached an impressive 150 single-spaced pages. In it, the Communist regime promised to abandon many of its predatory practices, from currency manipulation and the theft of intellectual property to the forced transfer of technology and its secret subsidies to its hi-tech companies.

Beijing even appeared ready to back these promised structural changes by agreeing to actual enforcement provisions similar to those imposed on North Korea. The draft called for heavy penalties to be imposed on Chinese companies, or levied on China itself, if the agreement was violated.

The cable that arrived in Washington late on Friday, May 3, changed everything. The draft agreement had been gutted. Section after section had been crossed out. Americans who saw it said that Beijing was reneging on nearly all the concessions it had made earlier.

Had China’s trade negotiators been acting in bad faith all along?

Perhaps. After all, Beijing has a long history of duplicitous behavior.

But I think the real reason that China backtracked is named “Joe Biden.” The former vice president had just ended months of speculation over his political future by announcing he was running for president on April 25.

The Chinese blew up the negotiations a few days later.

They had decided to run out the clock on President Trump’s first term, convinced that they would get a much better deal from a future President Biden.

Who can blame them? Biden has a long history of being a friendly voice for US-China relations. The Chinese side had every reason to expect that Biden, like Obama, would turn a blind eye to the theft of American jobs, factories, and intellectual property by an increasingly arrogant and rapacious PRC.

They probably even hoped that he, in return for a few empty promises, would quickly set aside the Trump tariffs that were crippling the Chinese economy.

But Beijing had another reason to bet on Biden: they had given sweetheart deals to his son, Hunter Biden.

As Peter Schweizer has documented in his book, “Secret Empires,” the vice president took his son along on Air Force Two when he flew to Beijing in December 2013.

Not long after the father and son duo returned to the US, Hunter Biden’s small firm received a $1 billion private equity deal from the Chinese government. This was later increased to a cool one-and-a-half billion.

As Schweizer wrote, “The Chinese government was literally funding a business that it co-owned along with the sons of two of America’s most powerful decision-makers.”

Now you see why Beijing’s leaders were convinced that they had Joe Biden in their pocket — or at least in their pocketbook.

At the time, the former vice president seemed like a sure bet — not just to Beijing but to many on this side of the Pacific. The early polls suggested that he was a shoo-in for the Democrat nomination, and the odds-on favorite to beat Trump.

Betting the farm on Biden, the Chinese likely stiffed Trump’s negotiators.

Now they seem to be having second thoughts. Negotiators are crisscrossing the Pacific again, and the Chinese have placed a couple of big orders for farm products.

Are they hedging their bet on Biden, or simply biding their time until they get the election result they want?

Time will tell.

Meanwhile, this being Trump, there is a price to pay for such perfidy. The tariffs are a little higher now and the terms of any future agreement will be even tougher.

Vice President Mike Pence did not mince words on Thursday when he said that the US will continue to insist that China make significant reforms to its economic system, including abandoning trade barriers, forced technology transfers and predatory subsidies for “national champion” businesses.

And Trump himself has made clear that, if no agreement is reached by the time of the 2020 election, Beijing will have an even steeper hill to climb during his second term.

Steven W. Mosher is the president of the Population Research Institute and the author of “Bully of Asia: Why China’s ’Dream’ is the New Threat to World Order.”