NEW YORK (Fortune) -- Why do some people get hooked on drugs and alcohol, while others can party hard and walk away? We tend to think it's a matter of willpower or moral fiber, but it has more to do with a roll of the genetic dice.

Large-scale studies of twins provide strong evidence that addiction ranks "among the most heritable of mental illnesses," says Dr. David Goldman, who heads the Laboratory of Neurogenetics at the National Institute on Alcohol Abuse and Alcoholism.

Of course, personal experience and social influences matter, too. Addiction researchers like Goldman have begun to pinpoint how specific experiences combine with genetic factors to slick the road to addiction.

Numerous genes have been linked to addiction, though fewer than a dozen have been strongly implicated.

Some are substance-specific, for example, genetic variations that influence the metabolism of alcohol. Some relate to mood, anxiety, and personality disorders, which are often present in people who seek solace or stimulation in alcohol or drugs. Some gene patterns are involved in more than one type of addiction, perhaps influencing brain pathways involved in seeking rewards.

"If you have a twin who uses cocaine, it makes you more likely to use heroin. If you have a twin who uses tobacco, you are more likely to use alcohol," Goldman explains.

Even the tendency to try a dangerous, illegal drug like crack or heroin is partially under genetic control. For instance, an area on chromosome 11, associated with taking risks and seeking novel experiences, lies near a region that has been linked to addiction.

Researchers use animal studies to measure the addictive tug of a particular drug. Marijuana and hallucinogens are not very habit-forming, while cocaine and opiates are so compelling that lab rats prefer them to food.

What's interesting, says Goldman, is that the more addictive the substance, the stronger the role of heredity in causing an addiction to it. Thus, he explains, while genetics strongly influences your risk of becoming a crack addict, becoming a pothead has more to do with social factors like "whether you like rolling joints or the company of other marijuana users."

As every social drinker or pot smoker knows, individuals vary markedly in their response to substances. Much of this is genetically determined and it has big implications for who gets hooked.

Some folks can't handle opiates, notes Goldman; even a medicinal dose of codeine makes them feel sick. Responses to alcohol also vary enormously. Some people literally get a bigger kick out of champagne, because alcohol provides a bigger boost to their endorphin levels -- a difference that has been mapped to variations in opiate receptor genes.

Differences in how well people handle the ill effects of drinking -- nausea, dizziness, and so on -- are also under genetic control -- and influence the risk of addiction.

In both animals and humans, individuals who are less sensitive to these unpleasant effects have a higher rate of addiction. Regions on chromosomes 4 and 5 that govern the neurotransmitter GABA appear to play a key role in determining alcohol tolerance.

On the other hand, two genes that are common in Asian populations -- present in about 36% of Chinese, Japanese, and Koreans -- cause people to turn red in the face and develop a rapid heartbeat and nausea when they drink.

The phenomenon, sometimes called "Asian glow" or "Asian flush" is due to a build-up of a nasty alcohol byproduct called acetaldehyde, a chemical cousin of the preservative formaldehyde. (The anti-drinking drug antabuse works the same way.)

People with genes for this unpleasant flushing syndrome are, of course, less likely to develop a drinking problem. Those who drink anyway are putting themselves in peril. Recent research shows that they have a high risk of developing deadly esophageal cancer. For the half-a-billion people who carry these genes, concludes Goldman, "alcohol is now identified as a carcinogen."

But genes alone do not cause an addiction. Researchers like to point out that, as with other ailments linked to lifestyle -- heart disease, obesity, and lung cancer, for example -- genes merely load the gun, while the environment pulls the trigger.

New studies are beginning to reveal precisely how this can work. For example, women who were abused as children are known to have high rates of alcoholism and yet some show remarkable resilience despite a history of abuse. The difference in vulnerability can often be traced to variant versions of a gene that controls a key brain enzyme, MAOA (monoamine oxidase A), which helps regulate the brain's response to stress.

A 2007 study, led by Italian researcher Francesca Ducci, found that women who carry a gene for low MAOA activity are strongly prone to becoming alcoholics if they were abused as children, while those with a high-activity MAOA gene, are much more resilient. It takes both the gene and the childhood trauma for the pattern to emerge. Among women who were not abused, there's no relationship between the MAOA gene and addiction.

Researchers hope that a better understanding of the genetics of addiction will lead to more effective treatments. Happily, that's already on the horizon.

The drug naltrexone was developed to treat alcoholism, but for many addicts, it's not terribly effective. Recent research shows, however, that for a subset of alcoholics who have a genetic variation in one of their opioid receptors -- 25% to 30% of the population -- the drug, which is used in conjunction with psychotherapy, works very well indeed.

University of Pennsylvania psychiatrist David Oslin and his colleagues are now conducting a trial to see if screening for this gene and prescribing the drug accordingly would lead to better outcomes in the notoriously difficult business of treating alcoholism.

Matching treatment to the patient's genotype could be the future of the field. And, Dr. Oslin observes, "It reinforces for the patients that they are not just a bad person or lack will power. It resonates with the notion that their brain may work a little differently than other people's and that this really is an illness they can treat like any other."