An inquiry into the killing of schoolboy Bailey Gwynne has recommended teachers should be given new powers to search pupils.

The 16-year-old died after being stabbed through the heart at Cults Academy in Aberdeen on October 28 last year.

His killer, who cannot be named because of his age, was found guilty of culpable homicide after a trial at the High Court in Aberdeen earlier this year.

The review's findings published on Tuesday included a recommendation that the Scottish Government should consider "amending the law in relation to searching pupils".

Currently, teachers are only able to carry out searches if pupils give their consent. If consent is not given, teachers have the option of contacting parents and police.

The inquiry - led by Andrew Lowe, chairman of child and adult protection for Renfrewshire - also recommended that the Scottish Government should "explore the further legislative controls that can be brought to bear on the purchase of weapons online."

STV News previously revealed that a pledge from 14 major retailers to introduce tougher rules on the sale of weapons is not being enforced in Scotland.

The inquiry described the attack as an "unplanned, spontaneous conflict that emerged rapidly" and said it "could not have been predicted or averted".

It did find the fatal stabbing, which followed an argument over a biscuit, "was potentially predictable and avoidable if those who knew [the killer] carried weapons in school had reported this to staff".

During the five-day trial in March, a witness said they had seen Bailey's killer with a knife in school "maybe 25 times" before the incident. Aberdeen City Council said teachers had never been told.

The trial heard Bailey's killer went to school armed in an attempt to "act tough and be cool" and bought the knife used in the stabbing from online retailer Amazon because "they don't check if you're over 18".

The review also recommended that police are informed each time a child is caught with a weapon in school.

An investigation by STV News found that nearly 700 children have been excluded for carrying out attacks with weapons in Scottish schools over the last five years.

It also showed that police were told not about every assault and that confusion about the definition of "weapon" had caused councils to misreported attacks.

Mr Lowe's review found that a 2007 incident where Bailey's killer was involved in an attack on another youth "did not reveal a violent child but a child under very significant and continual pressure from his brother".

Cults Academy head teacher Anna Muirhead said that since the killing the school has "worked very closely" with pupils to "get the right balance between remembering Bailey but also encouraging them to re-focus on their education".

In response to the findings, Aberdeen City Council's chief officer's group said : "[We] are determined to implement any changes to practice that aim to decrease the likelihood of such an awful event taking place in the future.

"But we are well aware that no amount of future change will alter the fact that Bailey is no longer with us and that his loss continues to be keenly felt."

However, teaching union the Educational Institute of Scotland said it does not support greater search powers for teachers.

General secretary Larry Flannigan said: "The EIS does not support the routine screening and searching of pupils.

"Such actions are likely, over time, to undermine the trust and respect which exist between pupils and school staff and undermine the efforts to forge an open, supportive and inclusive school community.

"The EIS would not welcome the introduction of statutory powers to enable searching of pupils without parental support. The experience from England, where teachers have such power, does not suggest that it is a crucial area of intervention.

"Instead the focus should continue to be on building positive relationships in schools, ensuring that students are aware of the dangers associated with carrying weapons, and addressing the impact of austerity cuts to support staff.

"Staff should first question a pupil, then, if appropriate, request that the pupil surrenders the item. If this strategy is unsuccessful, the school should contact the parent/guardian and/or the police depending on the circumstances and the level of risk.

North east Scottish Conservatives MSP Ross Thomson said: "The findings published today show that this tragic incident at Cults Academy could not have been predicted.

"However, the review has found that it could have been avoided if concerns that the boy in question carried a knife to school had been passed on to staff. It is vital that pupils are encouraged to come forward with such information in future.

"Aberdeen City Council has rightly reviewed its own policies in relation to knife crime, but wider lessons must be learned.

"In particular, the Scottish Government must immediately look to toughen up laws on buying weapons online and also consider amending existing legislation to allow teachers to search pupils when necessary."

Lewis Macdonald, Scottish Labour MSP for the north east, said: "The report highlights an issue with the law in this area, which requires headteachers to have consent in some cases before they search pupils for offensive weapons. It also highlights the need to review the law about the sale of weapons online.

"The family of Bailey Gwynne and his friends have already experienced what can happen when young people carry weapons. There is an urgent need to review the law in both these areas if we are to keep pupils safe when they go to school."

Aberdeen City Council has set up a helpline with educational psychologists for pupils which will be active from Tuesday afternoon until 5pm on Thursday. The number is 01224 764 515.

Counsellors will also be present in Cults Academy for "young people, families or staff" following the publication of the report, the council said.