In a new study, researchers explained how animals develop defense mechanisms and why they develop the ones they do.

Have you ever wondered why different animals develop different defense mechanisms to protect themselves against predators? While some use a stinking body odor, others opt for more violent means. For example, a chameleon changes color to defend itself from its predators while a skunk uses its stink to keep them at bay.

University of California researchers found that noxious spraying was favored by animals that were nocturnal and mostly at risk from other animals.

"The idea is that we're trying to explain why certain antipredator traits evolved in some species but not others," said Theodore Stankowich of California State University in a statement. He also noted that this study not only explains why skunks are stinky and why banded mongooses live in groups but also breaks new ground in the methodology of estimating predation risks.

Sociality as a defense mechanism was favored by animals that were active during the day and potentially vulnerable to birds of prey.

"Spraying is a good close-range defense in case you get surprised by a predator, so at night when you can't detect things far away, you might be more likely to stumble upon a predator," Stankowich said.

Small carnivores like mongooses and meerkats choose to stay active during the day. This sometimes put them in danger, because they become vulnerable to birds. Therefore, they prefer to stay in large groups so that the threat can be detected even from far distances. Animals who adopt sociality as a defense mechanism also use other defenses such as calling out a warning to other members of their group or even mobbing together to bite and scratch an intruder to drive it away.

Findings of the study were published in the online edition of the journal Evolution.