An ex-prisoner has lost a legal challenge at the High Court against a request by police for him to provide DNA samples.
The man, known as R, had argued that the request infringed his human rights.
Under Operation Nutmeg, which runs in England and Wales, DNA has been gathered from people jailed for serious crimes before routine collection.
The Home Office said the judgement was a common-sense one that supported the work of the government and police.
Police could have been ordered to destroy thousands of samples if the legal challenge had been successful.
Since 1994, individuals convicted of serious crimes have had DNA swabs routinely taken to add to the national database.
The aim of Operation Nutmeg is to see if there are any matches to unsolved crimes among those who offended before that date.
By July of this year, 6,204 samples had been taken under the scheme with 111 being matched to crime scenes.
R - who was jailed for manslaughter in the 1980s but after his release was in trouble for a lesser, non-violent offence - argued that he had turned his life around since 2000.
The police force - which also cannot be named for legal reasons - contacted him in March. An officer hand-delivered a pro-forma letter which told him that because he had a previous conviction for a serious offence he was being asked to give the officer a DNA sample.
The letter went on to say that if he chose not to, he would be required to attend a police station within seven days and if he failed to do that he could be liable to arrest.
Stephen Cragg QC, acting for R, said his client believed his human rights had been breached because he had a right to a private life.
But Lord Justice Pitchford, at the High Court, said the request was both "lawful and proportionate".
R is now considering whether to appeal against the ruling.
A Home Office spokesman said: "We are committed to removing the DNA of innocent people from the national database and this common-sense judgement supports the work of the government and police in ensuring that DNA samples taken from thousands of people convicted of murder, manslaughter or sexual offences can be retained.
"Although we will carefully consider the contents of today's judgment, we stand by the principle that taking DNA samples from people convicted of serious offences is entirely justified by the need to solve crime."
The Association of Chief Police Officers welcomed the ruling and said DNA evidence was a "vital tool".
A spokesman said: "Operation Nutmeg has enabled the police to maximise the opportunities to prevent and detect crime as a result of the Crime and Security Act 2010.
"DNA evidence is a vital tool for the police which has helped convict thousands of violent and dangerous criminals and exonerated many innocent people.
"We recognise that there is an issue with the wording of some of the initial requests made to subjects.
"Acpo has produced an evaluation report of Operation Nutmeg that will be discussed by chief constables at the upcoming Chief Constables Council. This issue will form part of those discussions."