A new statutory code of practice should be brought in for the controversial police practice of stop and search, according to a report.

A review by HM Inspectorate of Constabulary in Scotland (HMICS) also called for stop-and-search targets to be removed and data collection and reporting to be improved.

HMICS has recommended a move from non-statutory or "consensual" searches to those where a person is stopped under legislative powers.

A code of practice backed by law would set out clear principles and safeguards for the public, the report concludes.

It found that officers, supervisors and managers in Police Scotland reported there was too much focus on stop and search and staff wanted the 20% target for positive searches to be removed.

HMICS also said it had "no confidence" in stop and search data held by Police Scotland due to a lack of guidance and processes within the force.

HM Inspector of Constabulary Derek Penman said: "We have suggested a way forward that should result in significant reductions in consensual stop and search across Scotland, whilst at the same time building a reliable evidence base to allow a more informed view on the future need for consensual stop and search.

"We have recommended a move towards legislative stop and search which, combined with improvements in recording practices, training, supervision and audit, should give communities across Scotland more confidence in the use of stop and search.

"We believe the development of a statutory code of practice would establish clearly-understood principles and safeguards for the public and would be particularly beneficial in providing clear and transparent guidance on the conduct of searches."

Police Scotland is conducting a review of stop-and-search practices and the requirement for consensual searches.

HMICS found that 70% of searches recorded in Scotland are consensual but there are substantial variations across the country, with the practice said to be "embedded" in some divisions.

The report says Police Scotland conducted 83 consensual searches of children aged 11 or under between June 23 and December 31 last year, after the policy was scrapped.

"The communication of the change in policy to cease searching children aged 11 or under could have been more effective," it concludes.

It also calls for stop and search to be removed as a key performance indicator for Police Scotland, noting that officers still thought volume targets exist.

"We remain concerned by the consistent feedback from officers and staff associations that performance is driving negative behaviours," HMICS said.

"Despite clear messages from the force executive that there are no volume targets, this does not seem to be well understood at an operational level."

HMICS also concluded that there is currently no clear link between the use of stop and search and reductions in crime.

Among the report's 23 recommendations is a call for Police Scotland to consider implementing a policy of a "general presumption" among officers that stop-and-search encounters should be legislative.

Definitive guidelines should be developed for staff on what constitutes a stop and search and how they should be recorded and counted, steps should be taken to improve data collection on the practice and an assessment of officer training on stop and search carried out.

The force should also record seizures of alcohol separately on the national stop-and-search database to avoid artificially increasing the figures, the report said.