A 16-year-old boy who died after being stabbed at an Aberdeen secondary school has been described as a "gentle and caring pupil".
The teenager, understood to be fifth-year pupil Bailey Gwynne, was taken to Aberdeen Royal Infirmary with serious injuries after police were called to Cults Academy in the west of the city at about 1.30pm. He died a short time later in hospital.
Head teacher Anna Muirhead said the school community was "totally devastated" and in shock following the teenager's death, which police are treating as a murder inquiry.
A 16-year-old boy has been detained in connection with the incident and is said to be helping police with their inquiries.
Ms Muirhead said: "Pupils and staff are in a state of total shock. The boy involved was a very gentle, caring pupil, with a lot of friends.
"I think it's fair to say the whole school community is totally devastated. At the moment of course our thoughts are all with the boy's close family and his friends and what they must be going through at this tragic time."
Scotland's First Minister Nicola Sturgeon tweeted to say: "All my thoughts are with the family and friends of the young man who has tragically died at Cults Academy today."
Police Scotland have not formally named the teenager but said his immediate family has been told.
Chief Inspector Graeme Mackie, the local area commander for Aberdeen South, said: "This is a shocking and extraordinary incident for Aberdeen, and firstly our thoughts are with the family and friends of the boy who has sadly lost his life today.
"A full and thorough inquiry has been launched and there will be a police presence in the area for the foreseeable future.
"We are working closely with the education authorities and wider community as I am sure this incident will be felt not only in Aberdeen but much further afield."
He told reporters that teams of specially-trained detectives have been interviewing witnesses who are pupils and teachers of Cults Academy.
Tributes have flooded in on social media for the teenager.
On Twitter, ?@RoryMcGregor2 wrote: "Condolences to the family and friends of Bailey. Cults Academy won't be the same without you."
Another tribute from ?@AndrewNeill43 stated: "Rest In Peace Bailey."
Meanwhile, @sophiathain stated: "Absolutely horrific news, such an innocent boy's life has been taken. Thoughts go out to Bailey's family and friends."
And ?@annamccluskeyxx said on Twitter: "Can't believe what happened today. RIP Bailey. Thoughts and prayers go out to your family and friends."
A Facebook page has also been set up in tribute to the pupil.
Nearby Cults Parish Church said it was opening tonight to support the shocked community.
Counselling is being made available to pupils and staff at the school which will be closed to pupils on Thursday and Friday.
The Rt Rev Dr Bob Gillies, Bishop of Aberdeen and Orkney, said: "Such dreadful events as this impact in the most terrible of ways upon so many people and upon so many families.
"My deepest grief is with all those whose lives have been changed for ever as a result of this death."
Cults Academy is in an affluent suburb of Aberdeen and has more than 1,000 pupils. It is described on its website as a six-year comprehensive serving the Lower Deeside area.
The academy has previously topped the Scottish Schools league table on the strength of its exam results.
Holyrood's Education Secretary Angela Constance said: "I'm deeply saddened by this terrible news and my thoughts are with the pupil's family and friends.
"Aberdeen City Council has arranged for support to be available to the school's pupils and teachers. We remain in close contact with the council and stand ready to provide any help that may be needed."
The council has set up a dedicated support number, 01244 264299, for those affected by the incident which opens at 8am tomorrow.