Lady Eliza Manningham-Buller, the former head of MI5, delivered a withering attack on the invasion of Iraq, decried the term "war on terror", and held out the prospect of talks with al-Qaida.

Recording her first BBC Reith lecture on the theme, Securing Freedom, she made clear she believed the UK and US governments had not sufficiently understood the resentment that had been building up among Arab people, which was only compounded by the war against Iraq.

Before an audience which included Theresa May, the home secretary, she also said the 9/11 attacks were "a crime, not an act of war". "So I never felt it helpful to refer to a war on terror".

Young Arabs, she said, had no opportunity to choose their own rulers. "For them an external enemy was a unifying way to address some of their frustrations."They were also united by the plight of Palestinians, a view that the west was exploiting their oil and supporting dictators. "It was wrong to say all terrorists belonged to al-Qaida," added Manningham-Buller.

Pursuing a theme which some in the audience may have been astounded to hear from a former boss of MI5, she said terrorist campaigns – she mentioned Northern Ireland as an example – could not be solved militarily. She described the invasion of Iraq as a "distraction in the pursuit of al-Qaida". She added: "Saddam Hussein was a ruthless dictator but neither he nor his regime had anything to do with 9/11." The invasion, she said, "provided an arena for jihad", spurring on UK citizens to resort to terror.

September 11 was a "monstrous crime" but it needed a considered response, an appreciation of the causes and roots of terrorism, she said later in answers to questions. She said she hoped there were those – she implied in western governments – who were considering having "talks with al-Qaida".

Some way must be found of approaching them, she suggested, though she said she did not know how, at the moment, that could be done.

Manningham-Buller, who retired in 2007, attacked the invasion of Iraq in an interview with the Guardian in 2009. However, she has never before expressed such antipathy towards the prevailing policies and rhetoric of the government which she had to endure when she was in office. The lecture is to be broadcast on Radio 4 on 6 September, and entitled Terror.