Researchers say that a simple invertebrate animal living in the sea about 500 million years ago experienced a 'genetic accident' resulting in extra copies of some genes.
This animal's descendants benefited from these extra genes, leading to behaviourally sophisticated vertebrates - including humans.
Intelligence in humans developed as the result of an increase in the number of brain genes in our evolutionary ancestors, giving us the ability to learn complex skills, analyze situations and have flexibility in the way in which we think, the journal Nature Neuroscience reports.
Seth Grant, professor at the University of Edinburgh, who led the research, said: "One of the greatest scientific problems is to explain how intelligence and complex behaviours arose during evolution."
The research also shows a direct link between the evolution of behaviour and the origins of brain diseases.
More From This Section
Scientists, however, believe that the same genes that improved our mental capacity are also responsible for a number of brain disorders, according to an Edinburgh statement.
"This ground breaking work has implications for how we understand the emergence of psychiatric disorders and will offer new avenues for the development of new treatments," said John Williams, head of neuroscience and mental health at the Wellcome Trust, one of the fund raisers for the study.
The research team studied the mental abilities of mice and humans, using comparative tasks that involved identifying objects on touch-screen computers.
Researchers then combined results of these behavioural tests with information from the genetic codes of various species to work out when different behaviours evolved. They found that higher mental functions in humans and mice were controlled by the same genes.
The study also showed that when these genes were mutated or damaged, they impaired higher mental functions. "Our work shows that the price of higher intelligence and more complex behaviours is more mental illness," said Grant.