Children who suck their thumb or bite their nails are less likely to develop allergies, a study suggests.
The explanation, say the authors in the journal Pediatrics, is the hygiene hypothesis - exposure to some germs strengthens the body's immune system.
Thumb-sucking and nail-biting appeared to prevent some allergies among the 1,000 people in New Zealand assessed periodically between ages five and 32.
But the habits had no bearing on either asthma or hay-fever risk.
Thumb-sucking and nail-biting was assessed and recorded at ages five, seven, nine and 11, and allergies were tested for at age 13 and 32.
About a third of the children were frequent thumb-suckers or nail-biters, and these children were significantly less likely to have allergies at the age of 13.
The odds of these children developing an allergy to things such as house dust mite or a pet cat or dog was about a third lower than those of the other children who did not have these habits.
And this protection appeared to last into adulthood, the University of Otago, Dunedin, team say - although this finding was less clear-cut.
Also, the way the study was designed means the researchers cannot determine whether the link is definitely causal.
Co-researcher Prof Malcolm Sears, from McMaster University, in Canada, said: "While we don't recommend that these habits should be encouraged, there does appear to be a positive side to these habits."
Holly Shaw, of Allergy UK, said: "Research that has been carried out in other countries also adds weight to this theory of the role the environment and gut microbiota play in shaping an individual's potential to develop a food allergy.
"Having pets at home, older siblings and living on a farm have also been identified as environmental influences that may have a role in the development of allergic disease'.