It was at a lavish party at Spencer House, the opulent former London residence of the family of Diana, Princess of Wales, that HBOS's fate was sealed. Sir Victor Blank, the city grandee who has been chairman of Lloyds TSB since May 2006, had been eyeing the possibility of a takeover of the Edinburgh-based bank for months, if not years. Lloyds's previous attempts to snap up rivals such as Abbey National and Northern Rock had been thwarted by regulators and competition watchdogs.

Finally Blank, a former corporate lawyer with Clifford Chance who is described as one of the most respected men in the City, saw his chance. All he needed was a little help from his old friend the prime minister to pull off the deal of a lifetime. The two men are said to have got to know each quite well when Blank was chairman of newspaper group Trinity Mirror and Gordon Brown was chancellor.

So when Brown and Blank got into a "huddle" at the Citigroup-hosted party in the palladian building overlooking Green Park, a Faustian pact was struck.

Brown, desperate to avoid the Groundhog Day of another Northern Rock-style run on a British bank, told Blank he would be prepared to waive normal competition concerns if Lloyds was prepared to acquire HBOS.

In exchange, Sir Victor gave Brown certain assurances. These included that the merged group would maintain mortgage lending levels, continue to provide loans to first-time buyers, preserve jobs in Scotland and delay the heaviest job losses until after the next election. Despite disingenuous claims to the contrary, a Lloyds spokeswoman later confirmed what everybody in finance knew - the merged bank will be firmly headquartered at Lloyds's existing 25 Gresham Street base in London.

"Eric Daniels the American-born chief executive of Lloyds has secured a remarkable deal," said Ian Gordon, a bank analyst at Exane BNP Paribas. "In our view, he is to be congratulated for seizing the moment to acquire the HBOS group for a fraction of its intrinsic worth."

However, Gordon warned that, given the state of HBOS's loan book and funding model, the deal is not without risk for Lloyds. "Lloyds will be under no illusions that it is acquiring a business with sharply rising impairments in UK retail, UK corporate and in its international businesses in Australia, Ireland, Spain and the US, together with a large portfolio of toxic assets."

Speaking at a crowded press conference last Thursday, Blank confirmed that Brown's acceptance that normal competition considerations would be ignored had been critical.

Brown basically seems to have invoked the "national interest" to keep watchdogs such as the Office of Fair Trading and Competition Commission off the merged bank's back. To some observers this is surprising, given the dominant position the new "superbank" will have in UK retail banking (35% of current accounts, 29% of mortgages and a quarter of the market in both savings and personal loans).

On analyst said: "This deal definitively re-establishes the banking oligopoly, and pricing power will only grow for the banks, with Lloyds the biggest beneficiary."

By pricing power, the analyst means the ability of banks to push up interest rates for mortgage holders and other borrowers, to pay lower interest rates to depositors and possibly boost charges as well. Arguably, the deal, although probably necessary for the short-term stability of the UK's financial system, is going to be harmful to consumers' interests in the long run.

Sandy Chen, an analyst with stockbroker Panmure Gordon, put it succinctly: "It's goodbye Howard, hello 0.1% current account rates."

James Hamilton, an analyst at Numis Securities, said: "We expect the deal to dramatically reduce competition for almost every product line in the UK, so increasing the long-term industry profitability."

Effectively, it seems Brown has sacrificed consumer interest on the altar of financial stability. The new "superbank" - which is expected to officially come into being in January - will have dominant positions across the financial spectrum, and will also have free rein to build on its quasi-monopolistic position at the expense of its customers, without much risk of competition authorities intervening.

Without the warm embrace of the more conservatively managed Lloyds, HBOS was facing a perilous future. If the acquisition had not been made possible the bank, despite its proud 300-year history, would almost certainly have faced the ignominy of being nationalised à la Northern Rock.

Despite protestations to the contrary from Alex Salmond, HBOS was largely the author of its own demise. Following its merger with Halifax in September 2001 - which was something the Scottish bank did "on the rebound", having failed in its attempts to acquire NatWest - the Bank of Scotland's culture changed considerably.

Out went the old-fashioned "banking is boring" approach, which included things like insisting that lending is covered by money entrusted to the bank by depositors - an approach favoured by former chief executives Bruce Pattullo and Peter Burt. Instead, the bank adopted what is now seen as an unsustainable business model and one which ultimately proved its undoing.

Under the leadership of Sir James Crosby, an actuary and former chief executive of Halifax, and Andy Hornby, the former Asda executive who took over the reins in July 2006, the bank basically pursued a growth-at-any-costs strategy as it sought to vacuum up market share from the Big Four banks - HSBC, RBS, Lloyds and Barclays.

It did this by offering market-leading interest rates on current and deposit accounts and promoting these with populist and in-your-face television commercials, including ones featuring singing bank employee Howard Brown. Angela Anderson, a teller from a Bank of Scotland branch in Glasgow, also starred in an advert, in which she sang her bank's praises astride a giant flying swan.

The bank also took a highly aggressive approach towards lending to commercial property and entrepreneurial businesses which included funding and buying equity stakes in property companies such as Crest Nicholson, McCarthy & Stone, Miller Group and Tulloch, even as the UK's property market was about to burst - or indeed had already burst, in the latter cases.

Andrew Clare, professor of asset management at London's Cass Business School, believes HBOS fell into the trap of believing the good times would never end, which was partially a consequence of having an inexperienced board.

"The top management seem to have forgotten that economies go in cycles," he said. "Partly because the last downturn was 16 years ago, and driven by a compulsive desire to boost their own pay packets through incentive schemes, they seem to have believed another crash would never come."

The whole model adopted by Hornby and his colleagues began to unravel when interbank lending and other wholesale financial markets seized up last summer. The Edinburgh bank found itself left with a severe funding gap - the difference between its loans and its deposits - that had risen to £198 billion. The bank was finding this shortfall increasingly difficult and expensive to keep refinancing since the onset of the credit crunch last August.

Investors had been taking fright for months, which was the main reason the bank's £4bn rights issue was almost universally shunned by shareholders, with underwriters Dresdner Kleinwort and Morgan Stanley having to pick up most of the unwanted shares.

Once the US government decided to hang US investment bank Lehman Brothers out to dry last Sunday, HBOS was effectively doomed. Institutional funders took fright and were increasingly reluctant to roll over their loans.

In his most recent disclosure in June of this year, Hornby said HBOS had arranged wholesale funding totalling £266bn, which was due for renewal in various quarterly or annual stages. Of real concern, however, was the £156bn of one-year or shorter maturities that were due for replacement by next June. Alex Potter, an analyst at stock-broker Collins Stewart, estimates that £128bn of this was due for renewal in the next three months.

"The bank had left itself up shit creek without a paddle, given the febrile state of global financial markets," said another analyst.

Michael Moss, a research professor at the University of Glasgow who has written company histories of the Trustee Savings Bank and Standard Life, says: "Their main mistakes were to have too many of their eggs in the one basket UK property and to be too dependent on wholesale markets for their funding. To blame speculators, as Alex Salmond did, is lunacy. You only need to look at the overnight rate to see that HBOS has been in trouble for ages."

The denouement came in spectacular fashion. Scottish business people say they have never witnessed anything like the volatility and collapse of HBOS's share price last Monday, Tuesday and Wednesday.

At one point, just before the BBC broke the story about the takeover by Lloyds at 9.16am on Wednesday, HBOS shares touched a new low of 88p. This was extraordinary, and represented a 93% loss of value compared with their peak of £11.53 in February 2007. At that time HBOS was valued at £44bn by stock market investors, nearly four times the £12.2bn price tag paid out by Lloyds.

At the end of the day, however, it took the intervention of the credit crunch for investors to wake up to the unsustainability of HBOS's model. The plunge in the HBOS share price to 88p was all the more astonishing given that the Financial Services Authority had professed to be "satisfied that HBOS is a well-capitalised bank that continues to fund its business in a satisfactory way" the previous day.

There is no doubt the collapse in HBOS's share price was exacerbated by short sellers - the so-called "spivs" of the City Salmond has blamed for bringing down a once-treasured national institution. However, these spivs would not have been unable to push it down this low unless there had already been something fundamentally wrong with HBOS's whole model.

Dan Macdonald, the chief executive of Macdonald Estates and chairman of the Scottish Property Federation, spoke for many when he said he was astonished by the speed of the takeover: "That one of Scotland's oldest and most important institutions has been snatched as it would at the end of a car boot sale is astonishing, absurd and demoralising."