Some genes exhibit pretty complex behaviour.  For example, the gene for sickle cell anemia manifests as sickle cell disease only when an individual is homozygous in that gene (i.e. They have inherited a copy of this gene from both parents).  Such individuals have a host of health problems, including being more susceptible to malaria.  However, individuals who are heterozygous (i.e. they inherited just one copy from one parent) for the sickle cell gene do not typically have sickle cell disease, and being heterozygous in this gene actually confers resistance to malaria.  In areas where malaria is a major cause of death, the gene for sickle cell anemia is much more common than it is elsewhere.