Is David Cameron losing it? After some of his recent outbursts you begin to wonder. There was his raising the prospect of war if Britain leaves the European Union. Then his latest royal gaffe (he’s had a few, like the Queen “purring” over the Scottish referendum result) telling Her Majesty that countries including Afghanistan and Nigeria are “fantastically corrupt”.

Now, there was a conspiracy theory going round Westminster yesterday, and actually reported by Sky News, that the PM had only been trying to drum up publicity for his anti-corruption summit being held in London today. But I think we can dismiss that. This was no government information exercise. It was a diplomatic blunder of the highest order for an national leader to criticise countries who are actually on their way to attend a summit in Britain.

But lapse of diplomatic protocol was the least of it. The Prime Minister has inadvertently turned this entire conference into a British corruption summit in which the world’s attention will be focussed on the motes in our own eyes. The response of the Nigerian president, Muhammadu Buhari, yesterday was brief and to the point. Yes, he admitted, there is serious corruption in Nigeria, but there would be a lot less of it if Britain would help return stolen Nigerian assets held in London property, luxury stores and bank accounts.

It would also help if the UK didn't connive with the corrupt individuals across the African continent by allowing them to use Britain's network of tax havens to hide their loot. Britain's 13 “treasure islands”, crown dependencies and territories like Cayman and British Virgin Islands, have for decades harboured funds exported by wealthy individuals using shell companies often set up by the Panamanian law firm Mossack Fonseca.

Transparency international, the anti-corruption watchdog, says Britain is a “big part of the problem” of corruption in Nigeria, where an estimated 40 per cent of Nigerian GDP is effectively stolen. A string of prominent Nigerians including current and former Senate chairmen, senior army chiefs and defence ministers were linked to the offshore assets revealed in the Panama Papers. More than half of the companies named in the leaked documents are based in the British Virgin Islands.

Mr Cameron was also found to have benefited, albeit indirectly, from an offshore investment vehicle set up by his late father, which featured in the hacked files. The PM has since moved to improve transparency by requiring British companies to be fully open about who their real owners are. Britain is to have a public (we are assured) “beneficial register” of who owns what, so individuals and companies cannot avoid tax by playing a shell game with their cash.

But territories like the British Virgin Islands, will not be following suit, meaning it’s business as usual in the tax haven game. And so long as they seek to attract business by offering low or no tax regimes then companies and individuals will continue to use them to avoid paying tax in their country of origin. These countries are governed by the UK Crown so this is like one huge state-sponsored tax avoidance machine.

As a reminder that it is not just black Africans who revel in financial secrecy, the investigative website theferret.scot has published a map giving the locations of the 4,835 UK companies and individuals cited in the Panama Papers. By no means are these people corrupt and there is nothing illegal in setting up an offshore company. Nevertheless, there will always be questions raised about why individuals feel it necessary to locate their wealth in offshore tax havens.

Of course, none of this means Mr Cameron is wrong to hold a global summit on anti-corruption, though some of the nations attending clearly believe it is largely a self-congratulation exercise on the part of the British government laced with a strong dose of post-imperial hypocrisy. But two wrongs don't make a right. And as anyone who has visited African states like Nigeria or Sierra Leone, routine corruption by public officials, police and even doctors and nurses is a greater problem than it is here.

Our corruption is less visible and tends to be concentrated among people higher up the food chain. One of Britain's biggest banks, HSBC, has been fined in America for money laundering. State-owned Royal Bank of Scotland faces $ 5billion fines for the sub prime mortgage scandal. The ever-growing inventory of banking scams from Libor rate fixing to “dark pool” trading may be regarded as “white collar crime” that doesn’t really hurt anyone, but of course it does. Libor affects interest rates on mortgages and anyone with a pension fund has lost out because banks are conniving with high-rolling share-buyers to conceal their trades.

The SNP leader of the House, Angus Robertson, had a pop at Mr Cameron at PMQs yesterday for lecturing countries on corruption when his own Conservative Party is under investigation for election fraud. Mind you, the Scots have to be just a little careful here. Some of the SNP's own, like Natalie McGarry, the MP for Glasgow East, are currently under investigation for alleged financial irregularities.

Nicola Sturgeon was heavily criticised recently for signing a memorandum of understanding, potentially leading to £10bn of infrastructure projects, with the subsidiary of a firm, Chinese Railway Group, which has been accused of “gross corruption” through bribing public officials. There is no suggestion Ms Sturgeon or any Scottish politician or civil servant was involved in corruption, but is shows how easily the tentacles can spread.

Scottish banks were certainly involved in nefarious dealings before the financial crash as the financial journalist, Ian Fraser, has recounted, not least in his exhaustively researched book Shredded, an account of the RBS disaster. And while there is not evidence any ministers were involved with banking irregularities, Scottish politicians of all parties fell under the spell of the big banks.

When the former First Minister, Alex Salmond, awarded £1.7m in Regional Selective Assistance to the accountants KPMG to set up a “tax planning” centre in Glasgow, Mr Fraser called it “a kick in the teeth to every ordinary tax payer”. KPMG were of course the accountants for Halifax Bank of Scotland, HBOS, which became a byword for irresponsible lending during the property boom, and has been accused of “criminal fraud” by the Irish Attorney General. .

The building problems affecting 17 Edinburgh schools was a reminder Scotland has been a playground for much criticised PFI schemes. Around 40 per cent of all school PFIs are in Scotland and, since they are all shrouded in commercial confidentiality, we literally don’t know what is going to fall down next.

Corruption in Scottish local government is very widely documented and the police have been brought into North Lanarkshire Council. Scottish football also has a lurid history of bungs and bankruptcies. When Rangers went bust in 2012 it emerged one of Scotland's richest football clubs was involved in a complex offshore tax avoidance scheme that went wrong.

No, we are not “fantastically corrupt”, but small country like Scotland, where everyone knows everyone else, is certainly not immune to corruption. And with the decline in council reporting, and newspapers strapped for investigative cash, we could be creating the ideal climate for corruption to thrive in the darker corners of the public sector.