Iranian president Mahmoud Ahmadinejad. 'Threats and sanctions have not weakened the regime’s determination to proceed [with nuclear weapons], but rather weakened ­opposition to it'. Photograph: Sven Hoppe/EPA

North Korea has set off a third nuclear test explosion. It has done so in defiance of the UN, America, Japan and even, reportedly, its sponsor, China. It has said to hell with everyone, in a brutal comment on western economic sanctions.

The UN security council met yesterday and Washington threatened "significant consequences" – code nowadays for "tighter sanctions". Every shred of evidence suggests that these will not achieve the declared goal. They will merely add to the impoverishment of North Korea's people by its own government. Sanctions are the most counter-productive tool known to diplomacy. Yet we keep imposing them. Why?

Sanctions assume that all countries react to external pressure as might a capitalist democracy. They assume a misguided regime will change its mind and put financial advantage above its definition of national interest. "Smart sanctions" (really dumb sanctions) further assume the rich can be punished without punishing the poor, and that all dictators' wives want to fly abroad and shop at Harrods. They assume that trade guides political action and political action trumps dictatorship.

Economic sanctions are hugely popular to western politicians, not because of their effect but because of their cause: the desire to stand on an international stage and being seen to "do something". They are the least-cost first resort of the laptop bombardiers of global intervention. They sound punitive and aggressive without inflicting any hardship on the imposer.

After North Korea the other target in the sanctions frame is Iran. Everything at present suggests that ever-tighter sanctions have done nothing to curb Iran's nuclear programme. Indeed, by inducing paranoia, probably the reverse. Sanctions have certainly "bitten", to the glee of their advocates. They have brought inflation and a collapse in the currency, the rial. They have harmed ordinary people and solidified sentiment against the west and the "great Satan" of the US. Assassination and cyber-weapons have wiped out a few scientists and scrambled a few computers.

What sanctions have not done is weakened the power of the ayatollahs or their private army, the Revolutionary Guards. Both seem as secure as ever, while (relatively) moderate civilian politicians are reduced to feuding and arresting each others' children. Iran's nuclear programme appears to proceed independent even of the organs of its own state.

A spoof article in the Economist last year portrayed Iran's supreme leader, Ayatollah Khamenei, ruminating on western nations' obsessive posturing towards his country. He mused that these were unstable, unreliable places, dangerous though probably not all mad. But since it was hard to be sure, "I would feel a lot safer if we already had that bomb". Similar insecurity drove sanctioned Cuba to accept Russian missiles in the 1960s, and sanctioned Iraq and Libya to pretend to build weapons of mass destruction in the 1990s.

Sanctions never stop bad things happening. Rather they entrench dictators, build up siege economies and debilitate the urban middle class from which opposition to dictatorship grows. As Khamenei said in a speech a year ago, sanctions were "painful … but make us more self-reliant". Indeed, for a regime to be sanctioned is to receive an elixir: witness Castro, Gaddafi, the ayatollahs and the ruling cliques of Burma, Afghanistan and North Korea. That sanctioned regimes sometimes come to an end is not proof that sanctions work, rather that they take a long time and usually require war to "work".

This is a rarely researched topic because sanctions are diplomatic ideology rather than science. A debate in 1998 in International Security magazine saw the Chicago academic, Robert Pape, barely challenged in his view that only around five of the 115 cases of sanctions imposed since the war could claim any plausible efficacy. Most merely inflicted "significant human costs on the populations of target states, including on innocent civilians who have little influence on their government's behaviour". They are a ready invitation to war.

When I was reporting on South Africa in the 1980s I became convinced that sanctions were aiding import substitution and benefiting the Afrikaner economy, probably giving apartheid an extra decade of life. They likewise prolonged Ian Smith's regime in Rhodesia. Sanctions made Libya's Gaddafi so rich he could spoon money into the London School of Economics. They made Saddam Hussein one of the 10 wealthiest people in the world. Besides, sanctions create sanctions-busting which, like drugs, is a global criminal industry born entirely of the idiocy of western diplomacy.

A year ago the Foreign Office defended yet another round of sanctions against Tehran on the grounds they would "hasten Iran's economic collapse and deepen rifts within the regime, in the hope that saner voices will deem the price of pursuing nuclear weapons too high". Economies don't collapse, any more than poverty changes governments. Even Greece, now the most "sanctioned" nation in Europe, has not collapsed. Places just get poorer. As for "saner voices", they go into exile, hiding or prison. That's where sanctions send them.

Iran is a proud nation of 80 million mostly Muslim people, one of many Asian and African states struggling between theocracy and democracy, tradition and modernity. These are agonising struggles among and within peoples, to which the west has contributed nothing but hostility and belligerence. Under the cloak of "counter-terror", it has been as crass as it was during the Crusades. Of course no one wants to see nuclear weapons spread. Russia tried to stop China getting them. China tried to stop North Korea. The west tried to stop India and Pakistan, while hypocritically tolerating Israel and the replenished arsenals of France and Britain. No pressure made the slightest difference to anyone.

If Iran really wants a nuclear weapon, it will get one – the more so when it is threatened with dire retribution if it does. That is how such states react to pressure. Ever since the dodgy election of 2009, threats and sanctions have not weakened the regime's determination to proceed, but rather weakened opposition to it. If ever there was a country unlikely to respond to diplomatic bullying, it is Iran. If ever there was a country that might respond to constructive engagement, to commercial, governmental and cultural intercourse, it is also Iran. Why the west should want to make it another North Korea passes comprehension.