MSPs have voted to bring in a law to control how biometric data is stored.
How police deal with personal data including DNA, fingerprints and facial images is covered in the Scottish Biometrics Commissioner Bill.
The bill recommends the appointment of an independent commissioner to ensure police investigations are lawful and ethical.
The legislation faced its final hurdle at Holyrood and was voted for unanimously by 110 MSPs to 0.
The bill was introduced by Justice Secretary Humza Yousaf following a report on the need to balance public safety with individual rights.
DNA samples are the ultimate detail in personal data, but until now there has been no code of practice for police and justice agencies, who rely on the information it contains to help them fight crime.
The bill should provide greater oversight of how the police take, store, use and dispose of data such as DNA samples, fingerprints and facial recognition images.
Mr Yousaf said technological advances in biometrics had brought huge benefits to police and other justice agencies in detecting, preventing and prosecuting crime.
But he added that there had to be robust rules around its storage.
He told the chamber: "The bill will go a long way to delivering greater transparency and accountability in how the police use biometric data in Scotland and to recognising how important this is to building and maintaining public trust.
"And I cannot stress enough how important it is that on the one hand we equip our police officers with the necessary technology to ensure they can keep us safe, however, on the other hand, equally let me stress how important it is that the public have absolute confidence in those technological advances in how their data will be collected, retained or indeed disposed.
"This bill... will hopefully help to provide members of the public with the reassurances they require."
Keeping up with criminals
The Scottish government's aim is that police will at least keep up with criminals when it comes to technology. And when it comes to biometrics, they want them to be able to give maximum reassurance to the public that data will not be misused.
Layers of accountability will include the commissioner, the independent code of practice and an advisory group which would liaise with stakeholders including Police Scotland and the Scottish government.
Currently, fingerprints and DNA evidence are gathered by police and analysed by scientists at the Scottish Police Authority (SPA) laboratories for the Crown Office, which prosecutes all crime in Scotland.
Scotland is seen as leading the field in biometric data storage after a £6m investment in forensic capability in 2015.
Scotland was the first country to introduce a new analytical standard where scientists look at 24 areas of each DNA sample, compared with the European norm of 17.
The new biometrics commissioner would be appointed by Holyrood and would be accountable to MSPs.
They would be able to make recommendations if they believe an organisation is not adhering to the code of practice, which could lead to the relevant body being called to account to parliament.