On the face of it, London mayor Ken Livingstone's trip to the World Economic Forum at Davos this week sets the seal on his ideological odyssey. Red Ken, the man who once argued that capitalism was directly responsible for more deaths than was Hitler, is off to pay homage to Coca-Cola, Google and the high priests of global finance. But back in London, Ken could be seen as playing an altogether different game: impeding globalisation and, with it, the future of socialism.

That might sound a bit cockeyed, so let me explain. The proposed take-over of the London Stock Exchange by the US-based Nasdaq is an open and shut case of self-devouring capitalism. Rightly, City minister Ed Balls has recognised it as such, and refused to intervene. To block the bid, he told an audience of bankers, "would have flown in the face of the traditions that have underpinned the City's success".

By contrast, Livingstone has opted for protectionism with his demands for inquiries and competition reports. Ken might do better to follow the teachings of his pre-Davos hero, the great communist connoisseur of free markets, Friedrich Engels.

As a Victorian mill owner and textile merchant, Engels was highly adept at following share prices and international markets. Based in Manchester through the 1850s and 60s, he was a regular at the Royal Exchange as the price of cotton rose and fell during the turbulent years of the American civil war. And while numerous textile concerns went to the wall, his own firm of Ermen & Engels remained remarkably solvent.

But by the time he retired to London in 1870, the economy had changed. Imperial finance, railway booms and joint-stock companies made the Square Mile's wealth surge. Gentlemanly capitalism was turning the stock exchange into the world's commercial hub. "From the large Manchester warehouses of the city to the ironworks and coalpits of Wales and the north and the factories of Lancashire, everything has been, or is being, floated," Engels remarked. It was the Big Bang of its day.

There was so much money about that the editors of the socialist weekly, Der Sozialdemokrat, thought their readers might like a financial page. Naturally, they turned to Engels for advice. His response was scathing. Not for ideological reasons, but on solid commercial grounds.

In something of a snub to the Manchester Guardian's City desk, Engels had little faith in the ability of progressives to decipher the nuances of the stock exchange. "I, too, have stocks and shares, buying and selling from time to time," he wrote proudly. "But I am not so simple as to look to the socialist press for advice on these operations. Anyone who does so will burn his fingers, and serve him right!" Engels, like Marx, turned to the Economist. For he was extremely supportive of the effects of the shares market. While there was no doubt as to that institution's innate "rascality", it mattered little, since the damage had already been done. Companies quoted on the exchange had long since exploited the working class, and were now merely playing with the profits. What happened to this surplus value stolen by the capitalists was, in practice, of little interest to the workers.

Rather than criticising the stock exchange for profiteering, or calling for it to be regulated or restricted, Engels thought it should be allowed to work its revolutionary genius. The trading of shares accelerated the concentration of capital and, as a result, the gulf between the classes widened and the conditions for a socially owned and planned economy grew more solid.

As the pace of capitalist development quickened, Engels thought, the prospects for socialist revolution improved. As the spearhead of capitalist progress, the stock exchange "should be allowed to deploy perfectly freely, so that even the most stupid can see where the present economy is taking them".

So Engels would certainly have welcomed Nasdaq's £2.7bn offer. As he and Marx recognised, capitalism was nothing if not a global force, and arbitrary attempts to restrict its totalising power to nation states were usually doomed. Livingstone's demand for the bid to be referred to the Office of Fair Trading would have been regarded as simply pissing in the historical wind.

But that is not to suggest that Engels didn't realise the commercial cost of such laissez-faire policies. On the contrary, he watched with detached amusement during the 1880s as Britain stuck firm to its dogma of free trade in the face of trenchant American and German protectionism. While the heirs of Cobden and Bright preached economic internationalism, the heavily protected cotton and iron industries of Connecticut and the Ruhr began ruthlessly to undermine British economic hegemony.

More than 100 years on, and at a similar economic cost, Britain remains wedded to the same free trade fetish. From Thames Water to BAA to P&O, we like nothing more than a good foreign takeover, typically accompanied by asset-stripping, out-sourcing and plenty of money in City fees.

But having acted as undertakers for so many national industries in the past, there is no reason why the London stock exchange shouldn't go the same way. Once upon a time, as a good socialist, Livingstone would have welcomed this expropriation of the expropriators. As Marx himself put it: "What the bourgeoisie produces, above all, are its own gravediggers."

· Tristram Hunt is writing a new Penguin biography of Friedrich Engels