Alex Salmond has written to the South African president to express Scotland's sadness at the death of Nelson Mandela.

Tributes poured in from across the country when his death was announced on Thursday and flags were flown at half-mast across Scotland, including at the Scottish Parliament and in Glasgow, the first place in the world to grant Mr Mandela a Freedom of the City award.

It was bestowed upon him in 1981 while he was imprisoned on Robben Island and the city continued to mark its support for the campaign to free him in 1986 when it renamed St George's Place as Nelson Mandela Place in his honour.

Thousands gathered in George Square when Mr Mandela visited the city to receive the award in October 1993, the year before he became president.

On Friday, the day after his death, hundreds of people gathered in Nelson Mandela Place to remember him.

In a letter to President Jacob Zuma, Mr Salmond wrote: "On behalf of the government and people of Scotland it is with sadness that I write extending our condolences to the South African people on the passing of Nelson Mandela.

"Nelson Mandela was one of the most remarkable people of the 20th century. With his passing the world has lost a towering statesman and the outstanding political leader of his generation.

"His integrity, humanity and compassion were an inspiration to countless millions, and his influence transcended ideology, race and creed."

The First Minister added: "In Scotland we are proud that Nelson Mandela had a longstanding commitment to and friendship with our country.

"Those links with Scotland were underlined by his being granted the Freedom of the City of Glasgow in 1981 when he was still imprisoned - the first city in the world to do so.

"The world is a poorer place for his passing, and our thoughts are with Mr Mandela's family and the people of South Africa at this time.

"This weekend our national flag, the Saltire, flies at half-mast, alongside the national flag of South Africa, as a mark of our respect to Madiba."

Books of condolence have been opened in the Scottish Parliament and Glasgow City Chambers and a minute's applause was held before kick-off at football matches in Scotland in Mr Mandela's honour.

The Archbishop of Canterbury praised Nelson Mandela for his "extraordinary" courage at a service of thanksgiving for his life.

The Most Rev Justin Welby told a congregation at St Martin-in-the-Fields in London' that the 95-year-old was the "rarest of leaders" as he thanked God for his leadership.