 -- President Donald Trump has long decried the trade imbalances between the United States and China, even going so far as a presidential candidate to say it amounted to economic "rape."

But as he complained about those inequities on Chinese turf on Thursday, the president offered a surprising qualifier: "I don’t blame China."

"After all," Trump said, "who can blame a country for being able to take advantage of another country to the benefit of its citizens? But in actuality, I do blame past [U.S.] administrations for allowing this out-of-control trade deficit to take place and to grow. We have to fix this because it just doesn't work for our great American companies and it doesn't work for our great American workers. It is just not sustainable.”

The president's remarks came during a signing ceremony in Beijing, during which $250 billion worth of U.S.-China business agreements were announced. During the ceremony, Trump and Chinese President Xi Jinping sat on a dais in arm chairs as U.S. and Chinese business leaders walked up to a table to sign multiple "memorandums of understanding" for future business deals, many of which are non-binding agreements and are years away from actually taking effect.

The president's remarks about shifting blame away from China for inequities stands in contrast to his rhetoric on China as a presidential candidate.

During an interview with "Good Morning America" in November 2015, for example, Trump described China as an enemy. "Because it's an economic enemy, because they have taken advantage of us like nobody in history," Trump explained. "It's the greatest theft in the history of the world what they've done to the United States. They've taken our jobs."

And at a campaign rally in Fort Wayne, Indiana in May 2016, Trump said, "We can’t continue to allow China to rape our country and that’s what they’re doing. It’s the greatest theft in the history of the world.”

At Thursday's signing ceremony in Beijing, the president went on to thank Xi for his recent efforts to restrict trade and cut off banking ties with North Korea, saying “we are very, very much on the same plane when it comes to security." He also expressed faith in Xi to fix the North Korea nuclear problem.

“China can fix this problem easily and quickly, and I'm calling on China and your great president to hopefully work on it very hard. I know one thing about your president. If he works on it hard, it will happen, there’s no doubt about it,” Trump said, prompting laughter in the room.

While in China, the president has also been generous in lavishing praise on his his host, President Xi, and describing their relationship in friendly terms, declaring there is “very good chemistry between the two of us.”