A collection of more than 14,000 photos spanning a century of Scottish life has been saved for the nation through a £1m acquisition.

The MacKinnon collection includes photos dating from the 1840s through to the 1940s and covers subjects ranging from family portraits and working life to street scenes and landscapes.

It was acquired from a private collector following a special collaboration between the National Library of Scotland and the National Galleries of Scotland with support from the Scottish Government, the Heritage Lottery Fund and the Art Fund.

The collection was built up by photography enthusiast Murray MacKinnon, who established a chain of film-processing stores in the 1980s, starting from his pharmacy in Dyce, near Aberdeen.

Mr MacKinnon, who sold the collection to the private collector, said: "The collection covers the day-to-day lives of Scottish people both rich and poor, the work they carried out including fishing and farming, in order to survive, and their social life including sport and leisure.

"These were turbulent times what with industrialisation, shipbuilding, new forms of transport, the social upheaval caused by the First World War in Europe and the Boer War in South Africa. The discovery of penicillin and radiography heralded the development of medicine and the pharmaceutical industry in Scotland.

"I would like to thank all the people involved in acquiring this collection for the Scottish nation, and for their great efforts in making this acquisition possible."

Highlights of the collection include portraits of Scottish regiments from the Crimean War by Roger Fenton and more than 600 original photographs from the pioneering days of photography.

There are also albums and prints depicting life in the main towns and cities from the late 1800s and early 1900s and scenes of shipbuilding, railways, herring fishing, weaving, whisky distilling, dockyards, slate quarries and other working environments.

Dr John Scally, National Librarian, said: "This acquisition is akin to buying Scotland's photographic album of 14,000 pictures and bringing it home, and together with the National Galleries of Scotland, we were determined to make that happen.

"I am confident that every Scot will feel a connection with these wonderful photographs and we look forward to sharing them with the public over the coming months."

A major exhibition of the MacKinnon collection will be held at the Scottish National Portrait Gallery next year, with touring exhibitions around the country to follow.