They may not have settled the enduring debate over whether gray hair makes a person look distinguished or just plain old, but scientists have identified for the first time a gene behind graying hair.

Researchers said on Tuesday an analysis of DNA from more than 6,300 people from five Latin American countries enabled them to pinpoint a gene that affects a person's likelihood of getting gray hair.

The gene, called IRF4, is involved in regulating melanin, the pigment responsible for hair color as well as the color of the skin and eyes.

People with a certain version of the gene are predisposed to hair graying, according to University College London human geneticist Andres Ruiz-Linares, one of the researchers in the study published in the journal Nature Communications.

RELATED: 8 ways to eat healthy

The researchers said hair graying is not driven exclusively by genetics, with other factors in the mix such as stress or experiencing a traumatic event.

"This is really the first study on the genetics of hair graying in humans," University College London statistical geneticist Kaustubh Adhikari said.

People spend a lot of time and money dyeing gray hair back to their natural hair color. The researchers said identifying this gene could offer a path forward for developing a treatment that could prevent or reverse graying.

"A drug that has effects on the melanin-production pathway in hair follicles as the follicles develop internally might reduce the need to apply external hair dyes on the scalp hair after it comes out. This is certainly a research avenue worth pursuing," Kaustubh said.

RELATED: Is city pollution making you fat?

The researchers combed through genetic information from men and women in Brazil, Colombia, Chile, Mexico and Peru, with a combination of European, Native American and African ancestry.

The gene variant predisposing people to early hair graying was essentially only seen in those of European ancestry. "This might, to some extent, explain why hair graying is more common in Europeans than in other populations," Ruiz-Linares said.

One of the researchers brushed aside the issue of whether or not gray hair is attractive.

"Personally I don't have much of a view regarding the social response to hair graying, but I find it an interesting model to study aging in general," said Desmond Tobin, a hair follicle and pigmentation biologist at Britain's University of Bradford.

The study also identified genes related to other hair traits including curliness, beard thickness, eyebrow thickness and predisposition for eyebrows that join together, known as unibrow or monobrow.