A new code of conduct over how stop and searches should be carried out by Police Scotland officers has been published by the Scottish Government.

The code aims to introduce the values of "fairness, integrity, respect and accountability" into the practice.

Officers will not be allowed to conduct stop and searches when they have no legal power to do so.

Voluntary searches have been the subject of political controversy in recent years with a debate over whether or not individuals knew they could have refused to be searched by the police.

The code states: "Constables must not search a person, even if they are prepared to submit to a search voluntarily, where no statutory power to search is applicable and they have no warrant to do so."

Under the code, if an officer approaches an individual to conduct a search he or she must state their "name and number" as well as "what legal search power is being exercised".

Individuals should not be searched purely based on "their physical appearance" but instead only if the police officer has "formed a genuine suspicion in their own mind that they are likely to find the object" which they are searching for.

The code will be put to MSPs for approval and if passed will come into force in May.

Justice secretary Michael Matheson said: "Stop and search is a valuable tool in combating crime but we must ensure a balance between protecting the public and recognising the rights of individuals.

"This new code is about finding that balance and maintaining the trust between the police and the public.

"People's views about when and how stop and search should be used have been integral to the shaping of the new code.

"With this new code we will ensure stop and search is carried out with the fairness, integrity, respect and accountability that we expect from our police officers in all of their duties."

Assistant chief constable Mark Williams said: "Police Scotland has made real progress in relation to its use of stop and search and very much welcomes the introduction of the code.

"We are currently training all our officers in advance of its introduction to ensure we are fully prepared."

The number of stop and searches conducted on average by Police Scotland has fallen by 93% over the past three years.