Key Points:

"Madoff Securities is the world's largest Ponzi Scheme."

This was the conclusion of the Securities and Exchange Commission, Wall St's regulator, when it charged Bernard Madoff with a fraud of US$50 billion proportions last Friday, a day after the veteran trader's sons called the police and turned him in.

But hang on, the quote is not from the SEC. The quote is actually from Harry Markopolos, a fast-talking Boston accountant, from a letter he wrote to the SEC in 1999 after he began snooping around Madoff's firm. Markopolos wrote again and again - but for nine years, the SEC failed to investigate and failed to uncover what now looks like the biggest scam in Wall St's history.

To say the failure is an embarrassment would be to understate it. For an organisation already fighting for its survival, and assailed for facilitating the Wall St free-for-all that has now trashed the credit markets, this is a new crisis it could do without.

Little wonder that SEC chairman Christopher Cox has got out the cat o' nine tails for a little self-flagellation. (Strictly, not self-flagellation. He is casting blame not on the politically appointed commissioners but on full-time staff members.)

Markopolos is something of a character in the Boston finance industry, an accountant famed for his analytical skill, who worked until 2004 at local investment management firm Rampart. He first looked into Madoff's trading strategies in 1999, when Rampart was considering a rival investment product, and decided that the returns Madoff claimed were too good to be true.

In 2005, he wrote again to the SEC. According to the Wall Street Journal, which has seen the letters, he said: "Bernie Madoff's returns aren't real and if they are, then they would almost certainly have been generated by front-running customer order flow from the broker-dealer arm of Madoff Investment Securities."

He last wrote as recently as last year. The SEC conducted two minor investigations of the broker-dealer business but never ventured on where Madoff kept his investment management operations.

It was here, under lock and key, that he kept his records - the real accounts and the fictitious set he showed to investors.

The fraud was a classic Ponzi scheme, Madoff confessed last week. Old investors were paid using money from new ones. The returns were "all just one big lie" and now, with investors clamouring for their money, there is nothing left. Giant banks, august hedge funds, private investors and struggling charities are all nursing catastrophic losses. And it all happened under the SEC's nose.

Now a furious Congress is asking to examine the watchdog's teeth.

The investigations into the SEC's role will examine whether a certain chumminess between Madoff and his regulators led them to take too much on trust. In a career spanning almost five decades he had become a Wall St grandee, a major force in the foundation of the Nasdaq and its former chairman. His reputation for speaking his mind made him a go-to guy when the SEC was examining regulatory issues surrounding electronic trading. He even served on one of its advisory panels.

At the very least, the investigations will touch on the debate about "regulatory capture", which has raged during the implosion of the credit markets. Academics have argued that the close contact between regulator and regulated creates a "groupthink", while the regulated industry spends heavily lobbying for a particular kind of regulation that has no counter-balancing lobbying from outside. At a business roundtable meeting last year, Madoff boasted of his relationship with the SEC.

"There's always this friction between the regulation side of the industry and the practitioners about where you draw the line. I'm very close with the regulators, I'm not trying to say what they do is bad - as a matter of fact, my niece just married one."

That marriage is now going to be part of the internal investigation that Cox promised this week. Shana Madoff worked in her uncle's business as a compliance lawyer.

Last year, she married Eric Swanson, who was until 2006 an SEC attorney in charge of overseeing stock exchange regulation of electronic trading. His team carried out one of the investigations into her uncle's firm, although the couple began dating later, his representatives said. Cox has demanded that "any SEC staff who have had more than insubstantial personal contacts with Mr Madoff or his family" recuse themselves from the investigation. In a parallel development yesterday, the US attorney general, Michael Mukasey, removed himself from the Department of Justice criminal investigation because his son, Marc, is representing Frank DiPascali, a senior official at Madoff's firm.

Madoff only registered the investment arm of his firm with the SEC in 2006, and the SEC says only 10 per cent of the 11,300 investment advisers registered are examined on a regular basis.

Markopolos' letters might have been a reason to push Madoff's firm to the front of the inspection queue. Amid all the mysteries, why the SEC failed to act may be the one that yields the most enduring lessons.