Human kindness has traditionally been regarded as something people learn through experience, but scientists have discovered that some people are actually born with genes that predispose them towards niceness.

Past research found that levels of oxytocin and vasopressin hormones influence how people treat one another, especially in close relationships.

In past experiments, people who were exposed to oxytocin, the cuddle hormone that promotes maternal behavior, appeared to be more sociable. Previous research also found that the hormone vasopressin was important in pair bonding for monogamous prairie voles.

Researchers at the University of Buffalo and the University of California surveyed 711 participants about their attitudes towards social responsibility like paying taxes or reporting a crime, their perception of the world and other people, and about their generosity like giving blood or giving to charity.

All participants also gave a sample of their saliva for DNA analysis, which researchers used to see whether participants had receptor-producing genes for oxytocin and vasopressin.

"The study found that these genes combined with people's perceptions of the world as a more or less threatening place to predict generosity," investigator Michel Poulin, an associate psychology professor at the University at Buffalo, said in a statement released by the university.

Researchers added that participants who reported the world to be more threatening were generally less likely to help other, unless they had versions of the receptor genes that are associated with ‘niceness,” which made them still want to help others even though they felt threatened by the world.

"The fact that the genes predicted behavior only in combination with people's experiences and feelings about the world isn't surprising because most connections between DNA and social behavior are complex,” Poulin said in the statement.

Other studies have also found a genetic component to pro-social attitudes and behavior like selflessness and generosity.

University of Edinburgh researchers published a study in the journal Biology Letters which included 1,000 pairs of identical and fraternal twins and found that selflessness appeared to be genetic. Researchers had asked study participants about their likelihood to pay more money to ensure that everyone gains access to medical care, and found that identical female twins were most likely to be more generous with their money regarding this aspect.

"Having identical and non-identical twins allows you to understand whether there is a genetic factor at play," study researcher Gary Lewis of the University of Edinburgh told ABC Science. "Identical twins, which share 100 per cent of their genes, are more similar than non-identical twins, who share only 50 per cent. You can infer genetic influence because of that biological fact."

"We aren't saying we've found the niceness gene," Poulin said. "But we have found a gene that makes a contribution. What I find so interesting is the fact that it only makes a contribution in the presence of certain feelings people have about the world around them."

"So if one of your neighbors seems really generous, caring, civic-minded kind of person, while another seems more selfish, tight-fisted and not as interested in pitching in, their DNA may help explain why one of them is nicer than the other," he concluded.

The latest findings were published in the journal Psychological Science.