While campaigning for the US presidency, Donald Trump talked tough on China. He accused the country of “raping” the US economically: its trade policies and currency manipulation were allegedly perpetrating “one of the greatest thefts in the history of the world”. In March, Trump put his money where his mouth was, announcing up to $60bn of tariffs on Chinese imports. The US, the White House proclaimed, was “strategically defending itself” from “economic aggression”. Within hours, the People’s Republic responded by announcing its own tariffs on key US exports: pork, apples, soybeans. The rhetoric of public opinion in China was revealing of the deeper history of this trade row. Chinese editorialists promptly linked Trump’s action back to 19th-century western aggressions, and specifically to the collisions that dragged China violently into a western-dominated international world. In punishing China economically, they declared, the US was plotting to “repeat the plundering of the opium war” – a conflict Britain fought between 1839 and 1842 to protect its revenues from the opium trade and open China to British goods and influence. Parts of the Chinese cybersphere quickly resorted to militant language: “The superpower game is joined … we will block soldiers with generals and floods with dams …bring it on!”

We need to understand how and why ​China remembers the opium war; we forget sensitivities about the events at our peril

Memories of traumatic clashes with the west and Japan during what is known as China’s “century of humiliation” (1839-1945) remain highly relevant to an ambitious, resurgent state. On the one hand it confidently sees itself as a superpower, but on the other it is suspicious that the west is trying to contain it. In this context, the opium war is far more than history: it has a powerful message for the present day. We need to understand how and why China remembers the conflict; we forget sensitivities about these events at our peril.

Stephen R Platt’s excellent new history of China and its relations with Britain and the US in the 50 years up to 1839 could hardly be more timely. One of the best anglophone historians of late imperial China writing today, Platt immerses the reader in the friendships and frustrations, pleasures and hazards of a formative period in Sino-western relations.

In the closing decades of the 18th century, Qing China was among the richest and most powerful empires in the world. Over the ensuing decades, economic, ecological and imperial overextension mired the dynasty in political dysfunction and domestic disorder. In the lively pages of Platt’s book, we encounter the desperate millenarian rebels and pirates who plunged into a hopeless civil war because the depredations of corrupt officials left them no choice. Against the backdrop of mounting chaos the Qing government unsurprisingly – but with dwindling success – sought to exert control over its borders by restricting European and American trade to the southern port of Canton.

The biographies of Anglo-Americans in China alternate with the narrative of the Qing empire’s implosion. European philosophers had acclaimed the country a repository of political virtue and wisdom. Through the early decades of the 19th century, a rowdy crew of British traders, missionaries, diplomats and politicians reinvented China as a rogue state: an alien, xenophobic nation that refused to play by the rules of the international game so recently invented by Europe. This rise in intolerance coincided with a massive escalation of Anglo-Indian opium smuggling to China between 1800 and 1839, eventually pushing the British and Chinese empires to war.

British ships destroying an enemy fleet in Canton, 1841. Photograph: Dea Picture Library/De Agostini/Getty Images

As an interest group of merchants and politicians became scornfully dismissive of the Qing empire, they claimed – partly to justify military action to achieve short-term economic and political objectives – that conflict with China was inevitable. Platt’s book passionately contends the opposite. He describes how, despite the tumult preceding the opium war, the majority of participants in Sino-western relations were determined to maintain a mutually beneficial status quo. Only a minority of reckless traders and opinion-makers “caused all the trouble” by pushing too fast and too hard for an extension in commerce and profits.

Platt writes beautifully, with a novelist’s eye for detail. He skilfully weaves through the book a cast of eccentric characters who mediated between China, Britain and the US. There are the missionaries who toiled to create tools of communication between China and the English-speaking world, such as the first Chinese-English dictionary, while pleading for a war to open the country to conversion. Thomas Manning, a Norfolk-born globetrotter, set his sights on mastering Chinese, grew a beard and smuggled himself into Tibet disguised as a Buddhist lama. He ended his days in a cottage in Dartford, plucking his beard out hair by hair.

At a moment when the demagogic Trump is making confrontational noises about Chinese “protectionism”, his administration would do well to read Imperial Twilight. It vividly evokes both the tragic consequences of British impatience over trade with China, and the stories of the many westerners and Chinese people who pragmatically coexisted and cooperated for decades before the declaration of war.

• Imperial Twilight: The Opium War and the End of China’s Last Golden Age is published by Atlantic. To order a copy for £21.25 (RRP £25) go to guardianbookshop.com or call 0330 333 6846. Free UK p&p over £10, online orders only. Phone orders min p&p of £1.99.