Crosby, an ally of Gordon Brown, said today he was stepping down because he felt it was "the right course of action for the FSA".

The resignation sparked a furious row in parliament, where David Cameron accused the prime minister of a "serious error of judgment" in appointing Crosby to the FSA and knighting him for services to the financial services industry.

Crosby's shock departure came just a day after MPs heard damaging accusations that he had dismissed HBOS's head of regulatory risk, Paul Moore, for raising concerns about the bank's rapid growth.

Crosby said there was "no merit" in the accusations made by Moore. In a statement, Crosby insisted he was "genuinely independent of government", and that he had no political connection or affiliation to the prime minister.

The allegations from Moore emerged yesterday as the Treasury select committee grilled four former bankers over their role in the financial crisis, including Crosby's successor Andy Hornby.

Moore supplied a dossier to the committee in which he said he had been dismissed in 2005 after trying to warn HBOS's board that its "over-eager sales team" were putting the company's financial stability in jeopardy.

Moore welcomed Crosby's decision to step down from the City watchdog.

"People who finally accept their responsibilities should be given credit. Once they have accepted their responsibilities they should be allowed to move on," Moore told theguardian.com.

Brown said today it was right that Crosby stepped down from the FSA so that he could contest Moore's allegations.

The prime minister defended his decision to appoint the former head of HBOS as an adviser, insisting that claims had been looked into in 2005 and were found "not to be substantiated".

Brown added: "However, it is right that when serious allegations are made they are properly investigated."

David Cameron attacked Brown over his links to Crosby, who recently conducted a major review of UK mortgage lending. "[He was] knighted by the prime minister for his services, he relied on him for advice, he was going to sort out the mortgage market ..."

Cameron said the 2005 investigation into Moore's claims was carried out before HBOS "went bust", and asked whether Crosby had now been dropped as a government adviser.

Brown said the former bank chief had completed the two reports he had been asked to undertake and so was no longer an economic adviser. He accused Cameron of focusing on trivial issues rather than wider economic problems.

The Conservative leader retorted: "Why can't the prime minister admit for once he made an error of judgment? James Crosby had the decency to resign, even the bankers have apologised, why can't the prime minister admit he was wrong to appoint him in the first place?"

Crosby led the merger of Halifax with Bank of Scotland, transforming the building society into a major player on the high street.

MPs heard yesterday that HBOS's reliance on wholesale borrowing to underpin its loans was its undoing, when the credit crunch left it unable to access the finance it needed.