text: The code received widespread support during consultation and was unanimously approved by the Scottish Parliament.
  It was introduced following concerns over the number of people being searched without a legal basis.
  The code says statutory searches must be "necessary, proportionate and in accordance with the law". There is also specific guidance on dealing with children and vulnerable adults.
  Non-statutory or "consensual" stop-and-searches are now banned entirely.
  The new code was drawn up by an advisory group led by John Scott QC.
  Justice Secretary Michael Matheson said: "The ability of police to stop and search individuals can be an intrusion into liberty and privacy, but remains a valuable tool in combating crime.
  "I have spent some time with police officers using the new code on our streets and am in no doubt that such searches will be carried out with fairness, integrity and respect.
  "The views expressed during the consultation period were absolutely key to shaping the new code."
  The code states that stopping and searching must be done for a good reason and be both "necessary and proportionate".
  This means that officers must have a "reasonable suspicion" based on "facts, information and/or intelligence" that the person being searched is likely to be carrying an illegal item.
  Police Scotland Assistant Chief Constable Mark Williams said: "Police Scotland welcomes the introduction of the code and has worked closely with the Scottish government to support its development.
  "It provides clear guidance to all our officers and places the rights of the individuals at the centre of any decision to carry out a search.
  "In preparation for the introduction of the code, all frontline officers have received training and we will continue to work closely with partners, particularly children and young people, to monitor its impact."
target: A new code of practice on police stop-and-search powers has come into force.