LONDON — To the bankers here, it seemed like a chance to make a quick $7 million — risk free.

Instead, their sweet deal turned into a $840.1 million debacle.

In May 2007, a handful of bankers in London agreed to take a role in a complex mortgage investment being devised by Goldman Sachs.

That decision set off a chain of events that left the Royal Bank of Scotland Group — to many Britons, a symbol of the excesses that brought the financial world to its knees — as the biggest loser in the deal that has now drawn Goldman into a legal maelstrom.

How R.B.S. became entangled in this investment, Abacus 2007-AC1, is a story of these financial times. What is perhaps most unusual about the deal, and the London bankers’ role in it, is that it was so routine. Abacus, which is now at the center of accusations that Goldman defrauded investors, was one of countless mortgage deals that ricocheted between Wall Street and Europe during the heady days of the boom.