Breaches of a proposed police code of practice on stop-and-search should not give rise to grounds for a legal claim, Justice Secretary Michael Matheson has decided.

The Scottish Government has made provisions for a code of practice on the controversial procedure in line with the recommendations of a Government-appointed advisory group led by John Scott QC.

The group recommended a statutory code, to be consulted on before implementation and with a regular review no later than every four years, with an early consultation on whether the police should have the power to search children under 18 for alcohol.

It also recommend that use of non-statutory stop-and-search, where members of the public were said to have given their consent to be searched, should end when the code is introduced.

Non-statutory searches were seen as particularly controversial as they had been used on children, whose capacity to give consent was called into question.

Government amendments lodged for the Criminal Justice Bill give effect to some of the group's recommendations.

The amendments state: "The Scottish ministers must make a code of practice about the carrying out of a search of a person who is not in police custody.

"A court or tribunal in civil or criminal proceedings must take a code of practice into account when determining any question arising in the proceedings to which the code is relevant.

"Breach of a code of practice does not of itself give rise to grounds for any legal claim whatsoever.

"Prior to making a code of practice, the Scottish ministers must consult publicly on a draft of the code.

"When preparing a draft of a code of practice for public consultation, the Scottish ministers must consult the Lord Justice General, the Faculty of Advocates, the Law Society of Scotland, the Scottish Police Authority, the Chief Constable of the Police Service of Scotland, the Scottish Human Rights Commission, the Commissioner for Children and Young People in Scotland, and such other persons as the Scottish ministers consider appropriate."

Other amendments set a limitation on the lawfulness of a search by a constable on a person who is not in police custody, sets a duty to consider a child's best interests and makes provisions about the possession of alcohol.

It states: "A person who is not in police custody may be searched by a constable while the person is to be, or is being, taken to or from any place by virtue of any enactment, warrant or court order requiring or permitting the constable to do so.

"A search is to be carried out for the purpose of ensuring that the person is not in, or does not remain in, possession of any item or substance that could cause harm to the person or someone else.

"Anything seized by a constable in the course of a search carried out under this section may be retained by the constable.

"When a constable is deciding whether to search a child who is not in police custody... the constable must treat the need to safeguard and promote the wellbeing of the child (under 18) as a primary consideration."

The amendments also confer on a constable the power to search a person under 18 for alcoholic liquor and to dispose of anything found in the person's possession that the constable believes to be liquor.