By Bridget Kendall
BBC diplomatic correspondent
The revelation to the BBC was made by Sir John Sawers, Britain's UN envoy
Iran offered to stop attacking British troops in Iraq to try to get the West to drop objections to Tehran's uranium enrichment project, a UK official says.
The disclosure by UN ambassador Sir John Sawers in a BBC documentary throws new light on backroom discussions between Iran and the West.
Roadside bombing attacks on British and American soldiers in Iraq were at their height in 2005.
The extent of Iran's role in arming and training those militias was uncertain.
Tehran denied a role, while British officials tended to hedge their accusations with references to 'circumstantial evidence'.
But now a senior British official has revealed that not only did the Iranians privately admit their involvement, they even made an astonishing offer to switch off the attacks in Iraq if in return the West would stop blocking Iran's controversial nuclear programme.
Sir John Sawers, currently Britain's ambassador to the United Nations, said Iranians raised the offer during informal private talks at a hotel in London.
"There were various Iranians who would come to London and suggest we had tea in some hotel or other. They'd do the same in Paris, they'd do the same in Berlin, and then we'd compare notes among the three of us," he told the BBC.
"The Iranians wanted to be able to strike a deal whereby they stopped killing our forces in Iraq in return for them being allowed to carry on with their nuclear programme: 'We stop killing you in Iraq, stop undermining the political process there, you allow us to carry on with our nuclear programme without let or hindrance.'"
The deal was dismissed by the British government and Iran's nuclear enrichment restarted shortly after.
It is just one incident in a revealing pattern of on-off backroom deals with the Iranians that appear to go back to 2001.
Former President Khatami offered to help oust Saddam, the report says
It emerges from interviews with both Iranian and American officials that after 11 September, 2001, Tehran collaborated so closely with the US in order to topple the Taleban and remove al-Qaeda from Afghanistan, that they even provided intelligence information to pinpoint military targets for bombing.
Hillary Mann, one of the US delegates, remembers how one Iranian military official pounded the table in his eagerness to get the Americans to change targets.
"He unfurled the map on the table and started to point to targets that the US needed to focus on, particularly in the north," she told the BBC.
"We took the map to Centcom, the US Central Command, and certainly that did become the US military strategy."
Over Iraq too, Iran's reformist President Mohammad Khatami offered to collaborate on ousting Saddam Hussein, arguing that the Iraqi leader was also Iran's enemy.
But relations deteriorated after former US President George W Bush accused Iran of being part of an "Axis of Evil".
Attempts at negotiations initiated by the Europeans in the end led nowhere.
According to Nick Burns, in charge of Iran policy at the State Department for the Bush administration until last year, the American policy of talking tough with Iran did not prove productive.
Iran insists on its right to pursue a nuclear programme
"We had advocated regime change," said Mr Burns. "We had a very threatening posture towards Iran for a number of years. It didn't produce any movement whatsoever."
The glimpses in this TV documentary of a whole series of backroom talks over several years that on occasion yielded real collaboration would appear to be encouraging.
But the impressive collection of interviews does not address what prospects now lie ahead for a possible improvement in relations.
And the essential gap remains: without exception all Iranian policy makers, even the reformist Mr Khatami who may well stand again for the post of president this summer, insist on Iran's legal right to pursue its nuclear programme without impediment.
But the West remains deeply suspicious and alarmed at what it fears is subterfuge and deliberate procrastination to conceal Iranian plans to be able to make weapons from its uranium stocks, and therefore the Western demand remains that Iran must suspend nuclear enrichment.
President Obama's promise to "extend a hand" if Iran "unclenches its fist" may not be enough to break the logjam.
The documentary, Iran and the West: Nuclear confrontation, airs on Saturday, 21 February, at 2100 local time (GMT) on BBC Two.