Rasoul Movahedian, the ambassador of the Islamic Republic of Iran, told The Scotsman that Scotland and Iran shared "similar views" on many issues, such as the wars in Iraq and Afghanistan and nuclear non-proliferation.
And he said there was "fertile ground" for a stronger relationship with the controversial government of Iran's president, Mahmoud Ahmadinejad.
"I think that Iran and Scotland enjoy similar views on many regional and international topics and issues," he said. "The views and the position of this present government of Scotland pleased many people in Iran and enabled us to make a distinction between Scotland and England.
"We are very much pleased by the views of the present government, (which] is against the war, against chemical weapons, against proliferation, and advocates a world based on peace and friendship, which strives for wellbeing and economic progress. This provides fertile ground for further works."
The ambassador's words came on the day that families of Scottish troops about to leave for Afghanistan were briefed on the dangers they will face there.
Mr Movahedian said "of course" there was a distinction between the governments and the policies of Edinburgh and London.
He was speaking on a visit to Scotland, where he was an official guest of the Scottish Parliament. He met party leaders, including the First Minister.
Privately, Whitehall sources suspect Iran wants to try to exploit tensions between the UK and Scotland, especially with the fifth anniversary of the Iraq war coming up. A government source said: "If the mullahs in Tehran think Alex Salmond is a good ally against London, it throws up questions about the First Minister's judgment about his policies."
Sir Menzies Campbell, the former leader of the Liberal Democrats, told The Scotsman: "Perhaps it takes one ayatollah to recognise another in Alex Salmond. But seriously, the Iranian regime deals harshly with the rights of women and foments terrorism throughout the Middle East. Any similarity between that and the democratic traditions of Scotland is hard to swallow. This is an attempt to cause mischief."
Sir Malcolm Rifkind, the former foreign secretary, said there could be no separate foreign policy emanating from Scotland, and he questioned why the ambassador felt the need to speak to leaders north of the Border. "I don't think the Iranian ambassador would welcome the British ambassador speaking to the Azerbaijani minority who live in Iran," he said.
"There may be some Nationalist politicians in Scotland and some Iranians who think they have mutual views. But the ambassador's comments seem rather childish."
A Foreign Office spokesman said the UK's foreign policy was also Scotland's. "The UK government has one overall foreign policy," he said. "It has made it particularly clear what that is. We want to have a long-term relationship with Iran based on co-operation, but we feel they have to meet their international obligations in relation to non-proliferation, human rights and fundamental freedoms."
A spokesman for Mr Salmond said: "The ambassador is doing no more than recognising that the party now forming the Scottish Government was opposed to the war in Iraq – as, indeed, are a majority of MSPs in the Scottish Parliament.
"The ambassador was a guest of the Scottish Parliament and was welcomed by the Presiding Officer. The First Minister met him in an official capacity, as did other party leaders. Every guest to the parliament is treated properly, and the First Minister meets every visiting ambassador – as he did the Israeli and Polish ambassadors last week.
"Certainly, in the course of the meeting, the First Minister raised concerns over nuclear proliferation and human-rights issues in Iran."
While Mr Salmond has called for Scotland to be a model country for peace and reconciliation studies, the latest praise from the Iranians will prove embarrassing, as it comes from a country constantly criticised for human rights abuses.
In 2002, George Bush, the president of the United States, famously described Iran, Iraq and North Korea as an "axis of evil" over their support for terrorism and their attempts to acquire weapons of mass destruction.
Tony Blair, the former prime minister, claimed in 2005 there were Iranian links to explosive devices used to blow up British troops in Iraq. And the US general David Petraeus accused the Iranians of mounting a "proxy war" in Iraq through Tehran-backed Shia militias.
World opinion is also divided on whether Tehran has resumed its nuclear-weapons activity, with even the Russians and Chinese watering down their tacit support for the regime.
Mr Movahedian acknowledged what he said were the "distinct foreign policies" of Scotland in his interview with The Scotsman.
"We share the same view with the Scottish Government on nuclear proliferation. We have asked for a nuclear-free zone in our region. In the meantime, we recognise the right of nations to develop nuclear technology for peaceful purposes. My government is co-operating with the IAEA (International Atomic Energy Agency] for this reason."
Although Iran has faced UN sanctions because of its non-compliance with UN weapons inspections, the ambassador stressed: "We are in favour of a world free of nuclear bombs."
He defended the seizure at gunpoint of 15 Royal Navy and Marine personnel in what he said were Iranian waters last year.
Mr Movahedian hinted at tensions with Britain "since they have been involved in our domestic affairs since the beginning of the 20th century".
The ambassador cited "involvement of the government in engineering two coups d'tat in 1921 and in 1953" as remaining etched "in the historical memories of the Iranians".
A PLACE AT THE TABLE
SINCE coming to power last May, the SNP administration has tried to carve out a bigger presence for Scotland on the world stage.
The First Minister, Alex Salmond, has made little secret of wanting to have greater representation around the world. Unless Scotland becomes independent, it cannot have its own sovereign embassies, since foreign policy is reserved to Westminster.
Last year, Mr Salmond incensed UK ministers when he wrote to all 189 countries signed up to the nuclear non-proliferation treaty, asking them to back a separate seat for Scotland at the talks.
His letters were sent to regimes such as Iran and Zimbabwe.
He had argued that, as Scotland held a distinct position on the renewal of Britain's nuclear deterrent – Trident – it should have a separate seat at the table.
The SNP also waded into controversy at the height of the navy hostage saga last year, when the Iranians seized British troops patrolling the Persian gulf.
Angus Robertson, now the SNP's leader at Westminster, set up a meeting with the Iranian ambassador to discuss the Scottish elections, as well as the plight of the hostages.
The Scottish Government also wants to lead the UK's negotiations over fishing, believing its views are not being represented.
POOR RECORD ON RIGHTS
IRAN'S human rights record was thrown into sharp relief yesterday when Mehdi Kazemi, a gay Iranian teenager, was handed a temporary reprieve from deportation by Home Secretary Jacqui Smith.
His boyfriend was arrested by the Iranian police and hanged for sodomy in 2005.
Ms Smith announced the case would be reconsidered after concerns that he could face execution if removed to his homeland.
Mr Kazemi, 19, has been refused asylum in the Netherlands and is now likely to be sent back to Britain.