A team of researchers has sequenced the genome of the electric eel to determine how six different groups of electric fish around the world have evolved special organs that can produce electricity outside of their bodies.

Although all muscle and nerve cells have potential to create electricity, fish belonging to these six groups feature certain muscle cells that have evolved into something called electrocytes, which can generate significantly higher voltages than ordinary muscle cells. This special trait also helps these fish use their “electric sense” to detect other animals and objects even in the dark, National Geographic reported, citing a new study, published in the journal Science on Thursday.

“It's truly exciting to find that complex structures like the electric organ, which evolved completely independently in six groups of fish, seem to share the same genetic toolkit,” Jason Gallant, a zoologist at Michigan State University and the study’s co-lead author, said in a statement. “Biologists are starting to learn, using genomics that evolution makes similar structures from the same starting materials, even if the organisms aren't even that closely related.”

While a simple contraction of a muscle is capable of releasing a small voltage charge, some fish began to amplify this characteristic between 100 million years and 200 million years ago, eventually leading to the development of electrocytes from muscle cells. The six groups of fish, mentioned in the study, include South American knife fishes, African electric catfish, African elephant fish, stargazers, some skates and some rays, Reuters reported.

“Evolution has removed the ability of muscle cells to contract and changed the distribution of proteins in the cell membrane; now all electrocytes do is push ions across a membrane to create a massive flow of positive charge,” Lindsay Traeger, a graduate student at the University of Wisconsin-Madison and the study’s co-author, said in the statement.

However, in the body of electric fish, the electrocytes are aligned in such a way that the unique division of each cell allows for the “summation of voltage,” much like the way batteries are loaded in a series in a flashlight, scientists said, adding that an eel’s body contains many millions of such “batteries” working simultaneously to produce electricity.

“The myogenic electric organ has evolved six times in fishes to produce electric fields used in communication, navigation, predation, or defense,” researchers said, in the study. “Our results indicate that, despite millions of years of evolution and large differences in the morphology of electric organ cells, independent lineages have leveraged similar transcription factors and developmental and cellular pathways in the evolution of electric organs.”