Image copyright National Records of Scotland Image caption Private Andrew Cox, the uncle of actor Brian Cox, died during the Great War

The wills of 31,000 Scottish soldiers are being made available online as part of commemorations of the 100th anniversary of the outbreak of the First World War.

The poignant documents include the last wishes of 26,000 ordinary Scottish soldiers who died in the Great War.

Among the records are the wills for ancestors of some famous Scots.

These included the great-great-grandfather of pop star Paolo Nutini and the uncle of actor Brian Cox.

Image copyright National Record of Scotland. Image caption Private Cox left all of his property and effects to his mother

Paisley singer Nutini's great-great-grandfather John Feeley served in the Argyll and Sutherland Highlanders.

He died of wounds sustained during the Battle of Arras on 23 April 1917. Feeley left all of his property and effects to his wife, Annie, who lived until 1964

Image copyright National Record of Scotland. Image caption The will of Paolo Nutini's great-great-grandfather John Feeley is also included in the collection

Researchers at the National Records of Scotland also discovered the will of Andrew Cox, the uncle of Dundee-born actor Brian.

A rope-worker before the war, Private Andrew Cox served with the Highland Light Infantry.

He was killed in the Battle of Neuve Chapelle, aged 22, but his body was never identified.

Like many unmarried soldiers, Andrew Cox left all of his possessions to his mother Elizabeth.

The records are drawn from all the Scottish infantry and cavalry regiments, as well as the Royal Artillery, Royal Army Medical Corps, Royal Army Service Corps, the Machine Gun Corps and other units.

Almost all the wills were written by soldiers below officer rank, but some wills for commissioned officers were also included.

In addition to the wills from the Great War, there are almost 5,000 from Scots soldiers serving in all theatres during the Second World War, several hundred from the Boer War and Korean War, and wills from other conflicts between 1857 and 1964.

Culture Secretary Fiona Hyslop MSP hailed the launch of the online site.

She said: "These small but powerful documents are a testament to the sacrifice in wartime made by thousands of Scots, not only the soldiers themselves, but also their families and loved ones."

Tim Ellis, Registrar General and Keeper of the Records of Scotland, said: "We are privileged to be marking the centenary of the start of the First World War by making these remarkable records available.

"They give us a unique insight into the service of Scottish soldiers during the First and Second World Wars, but also in other conflicts before and since."

The Soldiers' Wills are available at www.ScotlandsPeople.gov.uk, at the ScotlandsPeople Centre in Edinburgh, and at local family history centres in Glasgow, Kilmarnock, Hawick and Inverness.