Scientists have found that in a few generations, the Tasmanian devil had somehow evolved to develop resistance to an unusual and highly contagious cancer that researchers previously believed would wipe the species off the planet.

The study published Tuesday in the journal Nature Communications gives hope that the species might survive the disease that killed nearly 80 percent of the devils. An international team of scientists came together to study the genetic changes in the animal in different points in time, including the time period before the cancer gained ground, and found that it had evolved to counter the disease.

The animal’s facial tumor was first identified in 1996. When the devils bite each other, they spread the cancer cells resulting in deformations on the animal’s face in the form of growths. The cancer usually kills the animal within six months and the disease had reportedly been plaguing the species for nearly 20 years.

The researchers studied genomes of at least 300 individuals from three different populations. They were in search of genes that had changed in frequency over time.

“Our hope was that we would find some genes that were perhaps associated with cancer or resistance to cancer or immune function,” Andrew Storfer of Washington State University and the study's co-author, reportedly said. “And in fact we did find seven different genes in two small regions of the genome that seem to have implications for cancers in other animals, including humans.”

Researchers believe that some of these genes probably direct the immune system to recognize and attack the cancer cells. The same changes were seen across three different populations ruling out the possibility of a random process.

Storfer added that the next step was to identify what the genes do for the devils. Scientists are currently growing these facial tumor cells in the lab and modifying the genome to understand how the genes might influence the growth of tumor cells.

While it is unlikely that these genetic changes would make the animal completely resistant to cancer, it might give them enough time to reproduce. “This gives us hope for the survival of the Tasmanian devil, which was predicted to be extinct but isn’t,” Storfer said.