On 7 June 1981 a phalanx of Israeli F-16 fighter-bombers entered Iraqi airspace on the orders of the then Israeli prime minister Menachem Begin. Their mission, codenamed Operation Babylon, was to destroy Saddam Hussein's nascent nuclear programme. In less than two minutes the eight F-16s dropped 16 1,000-kg bombs on the unfinished Osirak nuclear reactor, situated 10 miles south of Baghdad. It was an audacious attack: the world's first successful air strike on a nuclear facility.

Begin claimed to have averted "another Holocaust" by denying Saddam "three, four, five" nuclear bombs. American politicians – from Dick Cheney to Bill Clinton – would later agree with him.

Fast forward to 2012, and the Osirak attack is constantly invoked as a template for military action against Iran. Last month Amos Yadlin, director of Israel's Institute for National Security Studies and one of the pilots who bombed Osirak, said Iraq's nuclear programme was "never fully resumed" after that attack. "This could be the outcome in Iran," he declared in the New York Times. Earlier this month the current Israeli prime minister and sabre-rattler-in-chief Benjamin Netanyahu used a speech on Iran to again praise the Osirak operation, reminding his audience of how Begin ordered the attack despite being "well aware of the international criticism that would come".

Contrary to the conventional wisdom, however, Operation Babylon was a dismal failure – and did the exact opposite of what it was supposed to do. For a start, Saddam wasn't building a bomb at Osirak. Richard Wilson, a nuclear physicist at Harvard University who inspected the wreckage of the reactor on a visit to Iraq in 1982, noted how it had been "explicitly designed" by French engineers "to be unsuitable for making bombs" and had been subject to regular inspections by both on-site French technicians and the International Atomic Energy Agency (IAEA).

"The Iraqis couldn't have been developing a nuclear weapon at Osirak," Wilson tells me, three decades on. "I challenge any scientist in the world to show me how they could have done so."

For Wilson, the Israeli raid marked not the end of Saddam's nuclear weapons programme but the beginning of it. Three months later, in September 1981, Saddam – smarting from the Osirak incident and reminded of Iraq's vulnerability to foreign attack – established a fast-paced, well-funded and clandestine nuclear weapons programme outside of the IAEA's purview. Nine years after Osirak, Iraq was on the verge of producing a nuclear bomb.

Wilson's analysis is shared today by leading non-proliferation experts, including Columbia University's Richard Betts ("there is no evidence that Israel's destruction of Osirak delayed Iraq's nuclear weapons programme. The attack may actually have accelerated it"); Emory University's Dan Reiter ("the attack may have actually increased Saddam's commitment to acquiring weapons"); and Harvard University's Målfrid Braut-Hegghammer ("it triggered a covert nuclear weapons programme that did not previously exist").

In the context of the current Iranian nuclear crisis, says Wilson, the lesson to learn from Osirak is that "you've got to be damn careful not to create the situation you're trying to avoid".

And it isn't just academics in ivory towers who are sounding the alarm. "When we talked about this in the government, the consensus was that [attacking Iran] would guarantee that which we are trying to prevent – an Iran that will spare nothing to build a nuclear weapon and that would build it in secret," revealed General Michael Hayden, George W Bush's CIA director, at a seminar in January.

Remember: the collective view of the US intelligence community is that the Iranian regime doesn't have a bomb, isn't building a bomb, and hasn't yet decided whether it even wants a bomb. If Osirak teaches us anything, it's that the quickest way to help the Iranians make up their minds is to attack them.

And what would such an attack from the air achieve? US officials concede that Iran's nuclear facilities could be up and running again within two years. What then? Do we bomb them every two years? Make it a biennial event? Or, alternatively, perhaps, go for a full-scale invasion and occupation of Iran? That, after all, would the only way to guarantee that the Iranians didn't restart their programme in the way that Saddam did.

Listen to the verdict of America's top generals. At a conference in February, General James Cartwright, the former vice-chairman of the joint chiefs of staff, was asked whether bombing Iran would prevent the self-styled Islamic Republic from obtaining nuclear weapons. "No," he replied bluntly, before adding: "You're not going to kill the intellectual capital to just rebuild the centrifuges someplace else and continue on." Fellow panellist Admiral William Fallon, the ex-head of US Central Command, tapped his shoe on the floor to indicate how only "boots on the ground" could stop the Iranians from building a bomb.

Both Barack Obama and David Cameron continue to repeat the inane mantra that "all options are on the table". They aren't. Only a madman would give the order to invade and occupy a country three times the size and population of Iraq.

It's time we stopped learning the wrong lessons from history. A bombing campaign, on the Osirak model, won't work and could make matters worse; an invasion and occupation might work but isn't "on the table".

If the goal is to prevent – and not just delay – Iran from possessing a nuclear weapons capability, then the truth is that there is no military option. The only way to end this crisis is through direct diplomacy between the US and Iran; by jaw-jaw not war-war. Everything else is noise.

• This article was amended on 26 March 2012. It originally stated that the 1981 attack was the world's first air strike on a nuclear facility. It was the first successful strike, but the Iranian air force had also tried (and failed) to destroy Osirak a year before. This has now been corrected