Scientists have long theorized that the long neck of modern-day giraffes evolved to enable them to find more vegetation or to develop a specialised method of fighting.

The new study of fossil cervical vertebrae shows that the evolution has likely occurred in several stages as one of the animal's neck vertebrae stretched first toward the head and then toward the tail a few million years later.

The study shows, for the first time, the specifics of the evolutionary transformation in extinct species within the giraffe family, researchers said.

"It's interesting to note that that the lengthening was not consistent," said Nikos Solounias, a giraffe anatomy expert and paleontologist at New York Institute of Technology College of Osteopathic Medicine.

"First, only the front portion of the C3 vertebra lengthened in one group of species. The second stage was the elongation of the back portion of the C3 neck vertebra.

"The modern giraffe is the only species that underwent both stages, which is why it has a remarkably long neck," Solounias said.

The study is published in Royal Society Open Science.