Captain Walter Barrie's funeral held in Penicuik
Friends, family and colleagues have gathered for the funeral of a soldier shot dead by a rogue member of the Afghan army on Remembrance Day.
Capt Walter Barrie was playing in a football match between British soldiers and members of the Afghan National Army (ANA) at their base in Helmand province when he was shot at close range.
The 41-year-old, from Glasgow, was described as a "great man" by his wife.
The service was held at Glencorse Kirk in Penicuik, Midlothian.
It was to be followed by a private burial.
Mourners, wearing dark clothing or military uniform, gathered well in advance of the service.
A large photograph of the uniformed soldier stood at the front of the church, as did two floral wreaths, one white and one red.
Capt Barrie, of The Royal Scots Borderers, 1st Battalion The Royal Regiment of Scotland (1 Scots), had been mentoring and advising a brigade of the ANA to take over security in an area of southern Afghanistan.
Speaking before the service, Maj Norrie MacKinnon, from 1 Scots, said: "Today, the Royal Regiment of Scotland family, and in particular 1 Scots, will acknowledge the life of a very special officer.
"There are people in this world who seem to be larger than life. These people don't seem to get overwhelmed, angry or tired - somehow they keep their sense of humour, regardless of the circumstances.
"It is their energy, driving force and strength that make them special, and Capt Walter Barrie was one of those people."
He added: "Every member of my battalion currently deployed in Afghanistan will want to be at Glencorse Parish Kirk today to say their farewell and salute a true Scottish hero.
"But we also know that Walter would want nothing more than for his comrades to remain steadfast and at their post doing the job and the mission they were sent to do.
"Walter was a true professional, leaving a benchmark for us all, a standard to which we all aspire."
Speaking shortly after his death, Capt Barrie's wife Sonia said he had been a "doting and amazing father" to his 15-year-old son Callum.
He had been deployed to Afghanistan on 31 August and was killed on 11 November.
He had served for 25 years, including tours of Iraq, Bosnia, Kosovo, Northern Ireland and Afghanistan.
His colleagues in the Army called him a "brilliant bloke" and a "soldiers' soldier", with the Ministry of Defence describing him as an "approachable and compassionate officer" who cared deeply for the wellbeing of those around him.