A large study suggests that people with serious attention deficit hyperactivity disorder are less likely to commit crimes when taking medication.

The study, published in The New England Journal of Medicine, examined records of 25,000 people in Sweden to see if those with A.D.H.D. had fewer criminal convictions when taking medication than when they were not.

Of 8,000 people whose medication use fluctuated over a three-year period, men were 32 percent less likely and women were 41 percent less likely to have criminal convictions while on medication. Patients were primarily young adults, many with a history of hospitalization. Crimes included assault, drug offenses and homicide as well as less serious crimes. Medication varied, but many took stimulants like Ritalin.

“The study adds a lot,” said Dr. Gabrielle Carlson, director of child and adolescent psychiatry at Stony Brook University medical school, who was not involved in the study. “Cutting the crime rate, that’s not trivial. Maybe it will get some help for people in jail. It gives people who were on the fence maybe a little more confidence in this treatment.”