People with attention-deficit hyperactivity disorder who are involved in crime are less likely to reoffend when on treatment than not, a Swedish study shows.
Earlier studies suggest people with ADHD are more likely to commit offences than the general population.
Providing better access to medication may reduce crime and save money, experts and support groups say.
Researchers say the benefits of the drugs must be weighed against harms.
In the UK 3% of children have a diagnosis of ADHD, with half of them continuing to have the condition in adult life.
People with the disorder have to deal with problems with concentration, hyperactivity and impulsiveness.
Estimates suggest between 7-40% of people in the criminal justice system may have ADHD and other similar disorders, though in many cases the condition is not formally recognised.
Researchers from the Karolinska Institute looked at data from over 25,000 people with ADHD in Sweden.
They found people with ADHD were more likely to commit crime (37% of men and 15% of women) than adults without the condition (9% of men and 2% women).
The study published in the New England Journal of Medicine found when people took their medication they were 32-41% less likely to be convicted of a crime than when they were off medication for a period of six months or more.
Dr Seena Fazel, an author of the study and from Oxford University, says medication may reduce impulsive choices and may enable people to better organise their lives - allowing them to stay in employment and maintain relationships.
Co-author Prof Paul Lichtenstein says: "It is said that roughly 30 to 40% of long-serving criminals have ADHD. If their chances of recidivism can be reduced by 30%, it would clearly affect the total crime numbers in many societies."
Prof Philip Asherson, a psychiatrist and president of the UK Adult ADHD network, who was not involved in the study says: "We want people to have personal choice and personal responsibility - no-one is trying to force people to take drugs."
He points out it costs £100-£300 a month to provide medication for someone with ADHD, and taking into account the costs of unemployment and the criminal justice system, these would "vastly outweigh" the costs of medication, he says.
The authors caution that the side effects of the drugs used, such as Ritalin, must be taken into account.
"There are of course a lot of people with ADHD in the population who are not involved in crime.
"But for some people with the condition - if you don't treat them, they will try to treat themselves with street drugs," says Andrea Bilbow, founder of the National Attention Deficit Disorder Information and Support Service, Addis.
"A referral to specialist adult services can cost £1,500 - compare this with the amount of money you can save if you keep people out of prison - it's a no brainer."
The researchers looked at a variety of crimes - from petty crime to violent crime, finding a reduction in all of these when people took medication.
They acknowledge when offered medication, individuals may also get more attention from other support services - this could contribute to the reduction in criminal behaviour.
Prof Sue Bailey, president of the Royal College of Psychiatry, welcomes the study saying it "reminds us in an era of psychological therapies that medication can have a positive impact too".
The authors of the study point out ADHD can exist alongside other conditions such as conduct disorders, calling for further work to untangle the contribution these may make to criminal behaviour.
They feel the Swedish findings are applicable to the UK and much of Western Europe where rates of ADHD in children and the medication prescribed are broadly similar.