Mrs Thatcher was upset she was unable to help the Shah of Iran
Britain despatched an undercover diplomat on a covert mission to the Bahamas to convince the deposed Shah of Iran not to seek to settle in the UK.
The revelation comes in official archive documents made public 30 years after they were written.
The 1979 papers reveal that the British government was very concerned that Mohammad Reza Shah Pahlavi, then in exile, would seek to live in England.
But Prime Minister Margaret Thatcher was upset she could not help the Shah.
Mrs Thatcher told her foreign minister she was "deeply unhappy" not to be able to offer refuge to the Shah whom she said had been a "firm and helpful friend to the UK".
She somewhat unwillingly accepted the advice of the foreign office that to allow the Shah to settle on his estate in the countryside just outside London would generate security problems and put the staff at the British embassy in Tehran at risk.
Prime Minister James Callaghan and officials had already made the decision not to welcome the Shah before Mrs Thatcher won the 1979 election.
The archives reveal that Mr Callaghan wrote: "He is an immensely controversial figure in Iran and we must consider our future with that country. He will need to make interim arrangements".
A retired former ambassador to Iran was chosen to travel to the Bahamas, where the Shah had taken up residence at the Ocean Club to pass on the message.
Sir Denis Wright travelled to Paradise Island and, disguised as an old friend, succeeded in passing on the British government's message, though the details of the meeting itself are considered too sensitive to be made public.
Several months after the Shah arrived in the US for cancer treatment in late 1979, students took 63 hostages at the US embassy demanding that he be returned to the country to stand trial.
The Shah never returned to Iran. He died in exile in Egypt in 1980.