Jimmy Carter was praised for his "masterly" handling of the Iranian hostage crisis by Margaret Thatcher, transcripts of a phone conversation between the American president and British prime minister show.
The documents have been published by the National Archives as part of the 30-year-rule governing the release of official Whitehall papers.
The crisis began in November 1979 when 52 Americans were taken hostage at the US embassy in Tehran. They were held for 444 days, during which time Carter launched a botched military rescue mission. The hostages were released on 21 January 1981, the day Carter was succeeded by President Ronald Reagan.
Speaking on the phone on 18 January, Thatcher told Carter that she had been pleased to help secure their hopeful release. Iran agreed to release the hostages if the US unfroze Iranian assets, the Bank of England helped facilitate the transfer of funds.
"We just will wait anxiously for the next hour because if it comes off you really by your own efforts have answered your own prayers," Thatcher told Carter. "I must say that i think the whole situation has been wonderfully handled by you Jimmy, I think it has been masterly."
"We are very happy for you. And very happy for the American people and for the hostages. It really is absolutely wonderful. We were proud to be able to help."
Carter responded: "It is one of the most trying things I have ever had to face. It has been with me every day and night for 14 months.
"But people like you really made it easier for us and i am grateful to you and we will keep you informed as events unfold."
Thatcher told him: "We will wait with very great anticipation and very great joy in our hearts."
However while the Conservative British prime minister was full of praise for Carter, it is clear from another set of documents that she was pleased to see his administration be replaced by the Republican Ronald Regan.
A transcript of a phone conversation between her and German Chancellor Helmut Schmidt shows that Thatcher was "quite optimistic and very encouraged" by the prospects for the new administration given the tensions of the Cold War.
Schmidt was speaking to Thacher after he returned to Berlin following a trip to Washington DC. He told her that he was "looking forward with confidence to the cooperation with the new government" in the United States.
"I have the feeling that Ronald Reagan, whom I talked for about one hour, and another two hours with some of his adivsers and my advisers, that Reagan is quite open for a dialogue with the European partners and that he is seeking that."
Thatcher told him: "I think it will be much better, I think it will be much firmer... I have known Governor Regan for some time and I don't think he got a fair deal from the press in his country."
"I'm really quite optimistic because I think they'll take hold of things and I think it will be the end of uncertainty."