A study which has pinpointed the moment 'intelligence' evolved suggests it may have happened by accident.
The genetic 'fluke' which led to the evolution of our ability to reason may have also sown the seeds of mental illness, the researchers claim.
The study claims that the genes which led to complex behaviour evolved 500 million years ago, when our 'ancestors' were invertebrates living in the sea.
A mutation which led to the number of brain genes in our ancestors multiplying set life on Earth on the path towards complex thought, and our ability to analyse situations.
But the researchers claim that mental illness may be the 'price' we pay for intelligence.
Their conclusions are based on studying 'complex behaviours' in mice and humans, in experiments which involved identifying objects on touch screens - then tracing the genetic origins of these behaviours.
Professor Seth Grant, of 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, detailed in two papers in Nature Neuroscience, also shows a direct link between the evolution of 'complex behaviour' and the origins of brain diseases.
Scientists believe that the same genes that improved our mental capacity are also responsible for a number of brain disorders.
"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 study funders.
The study shows that intelligence in humans developed as the result of an increase in the number of brain genes in our evolutionary ancestors.
The researchers suggest that a simple invertebrate animal living in the sea 500 million years ago experienced a 'genetic accident', which resulted in extra copies of these genes being made.
This animal's descendants benefited from these extra genes, leading to behaviourally sophisticated vertebrates – including humans.
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 Professor Grant.
The researchers had previously shown that more than 100 childhood and adult brain diseases are caused by gene mutations.
"We can now apply genetics and behavioural testing to help patients with these diseases", said Dr Tim Bussey from Cambridge University, which was also involved in