Despite repeated denials by Number 10 that the war made Britain a target for terrorists, a letter from Michael Jay, the Foreign Office permanent under-secretary, to the cabinet secretary, Sir Andrew Turnbull - obtained by this newspaper - makes the connection clear.

The letter, dated 18 May 2004, says British foreign policy was a 'recurring theme' in the Muslim community, 'especially in the context of the Middle East peace process and Iraq'.

'Colleagues have flagged up some of the potential underlying causes of extremism that can affect the Muslim community, such as discrimination, disadvantage and exclusion,' the letter says. 'But another recurring theme is the issue of British foreign policy, especially in the context of the Middle East peace process and Iraq.

'Experience of both ministers and officials ... suggests that ... British foreign policy and the perception of its negative effect on Muslims globally plays a significant role in creating a feeling of anger and impotence among especially the younger generation of British Muslims.'

The letter continues: 'This seems to be a key driver behind recruitment by extremist organisations (e.g. recruitment drives by groups such as Hizb-ut-Tahrir and al Muhajiroon). The FCO has a relevant and crucial role to play in the wider context of engagement with British Muslims on policy issues, and more broadly, in convincing young Muslims that they have a legitimate and credible voice, including on foreign policy issues, through an active participation in the democratic process.'

Al Muhajiroon, formed by Omar Bakri Mohammed, the radical preacher who fled Britain after the 7 July bombings, was a recruiting organisation for young Islamic extremists in Britain.

Attached to the letter is a strategy document, also obtained by The Observer, which reveals further concerns. It says Britain is now viewed as a 'crusader state', on a par with America as a potential target. 'Muslim resentment towards the West is worse than ever,' the document, 'Building Bridges with Mainstream Islam', says.

'This was previously focused on the US, but the war in Iraq has meant the UK is now seen in similar terms - both are now seen by many Muslims as "Crusader states".

'Though we are moving on from a conflict to a reconstruction phase in Iraq, there are no signs of any moderation of this resentment. Our work on engaging with Islam has therefore been knocked back. Mr O'Brien [then a Foreign Office minister] has expressed his concern.'

However, all mention of the Iraq connection to extremism was removed from 'core scripts' - briefing papers given to ministers to defend the government's position on Iraq and terror.

The document begins: 'We do not see the Muslim community as a threat. Muslims have always made, and continue to make, a valuable contribution to society.'

The lines to be used by ministers include measures designed to address Muslim concerns, such as the introduction of religious hatred legislation and tackling educational underachievement among Muslims. But there is nothing to address the concerns raised by Jay eight months earlier.

The documents reveal deep divisions at the heart of government over home-grown religious extremism and its connections to British intervention in Iraq.

The Prime Minister has consistently said that the bombers were motivated not by a sense of injustice but by a 'perverted and poisonous misinterpretation of Islam'. Although Iraq was clearly used as a pretext by extremists, he said he believed it was ideology that drove them to kill. To press home the point, Downing Street issued a list of atrocities carried out before intervention in Afghanistan and Iraq. The claim was later undermined by the MI5, which said that Iraq was the 'dominant issue' for Islamic extremists in Britain.

Jack Straw, the Foreign Secretary, also rowed back from his comments immediately after the bombings that there was no connection with Iraq and the terror threat after it became clear that the public remained unconvinced.

But Jay's letter shows that the Foreign Office was convinced that foreign policy played a key role in radicalising young Muslims.

The letter outlines a list of 11 'work streams' to discourage extremism. They included delegations to the Islamic world, ministerial briefings for key members of the Muslim community and receptions to mark key Muslim festivals.

It is not known how Turnbull responded to the letter, although it is clear that, by January, there was a significant difference between what was being said within the Foreign Office and what ministers were officially being permitted to say in speeches.

Liberal Democrat home affairs spokesman Mark Oaten last night called on the government to come clean about the link between extremism among British Muslims and anger about Iraq: 'For the government to deny a link between the war in Iraq and dismay among the Muslim community is ridiculous. But to try to cover it up, when senior civil servants have recognised the seriousness of the resentment, is even worse.'

· Read the document here