Being brainy really is in the genes, according to new research.

The DNA we inherit from our parents accounts for over two-thirds of the difference in intelligence between individuals, suggests the study.

It is almost three times as important as environmental factors - such as wealth and nutrition, say scientists.

The study of British children sheds fresh light on the 'nature versus nurture' debate - and why some are brighter than others.

It was based on test scores from primary through the end of compulsory education of more than 6,000 pairs of twins.

The analysis showed educational achievement was highly stable throughout schooling.

It means most students who did well at the age of five continued to impress until graduation.

Genes explained about 70 per cent of this consistent progress - while the twins' joint family background was responsible for about 25 percent.

Meanwhile, their non-shared environment such as different friends or teachers, contributed to the remaining five percent.

Psychologist Dr Margherita Malanchini said the findings explain the substantial influence genes have on academic success - from the start of school to the last day.

She said: "Around two-thirds of individual differences in school achievement are explained by differences in children's DNA.

"But less is known about how these factors contribute to an individual's academic success overtime."

Dr Malanchini, of the University of Texas at Austin, said parents always worry about how their children will do in school.

For years research has linked educational achievement to occupational status, health or happiness.

But if performing well in school predicts a better life outcomes, children were probably born with much of what they will need to succeed.

Dr Malanchini and co author Dr Kaili Rimfeld said that is not to say an individual was simply born smart.

But even after accounting for intelligence, genes still explained about 60 percent of the continuity of academic achievement.

Dr Malanchini said: "Academic achievement is driven by a range of cognitive and non cognitive traits.

"Previously studies have linked it to personality, behavioural problems, motivation, health and many other factors that are partly heritable."

But, at times, grades did change such as a drop between primary and secondary school - largely due to non shared environmental factors.

Dr Rimfeld, of the Institute of Psychiatry, Psychology and Neuroscience at King's College London, said: "Our findings should provide additional motivation to identify children in need of interventions as early as possible, as the problems are likely to remain throughout the school years."

The researchers said influences on intelligence, including genetic and environmental factors, can best be studied during the period of compulsory education when the full range of family characteristics is represented.

Previous twin research has shown that GCSE performance is highly heritable, and to a lesser extent explained by environmental factors.

Dr Rimfeld added: "However, little is known about whether the same or different genetic and environmental effects contribute to individual differences in achievement over the course of compulsory education.

"The very high stability of academic achievement across compulsory school years is an interesting finding, particularly when considering children go through major cognitive and emotional changes from childhood to adolescence, as well as experiencing changes in teachers, friends, and schools."

Earlier this year a Scottish team identified more than 500 genes associated with intelligence by comparing the DNA of more than 240,000 people have been identified in the largest study of its kind.

They used data from the UK Biobank, comparing DNA variants from more than 240,000 people in the UK Biobank.

Previous research has suggested 50 to 80 per cent of variation in IQ is down to genetics.

But environment plays a role too. Well nourished children brought up in safe, unpolluted and stimulating environments score better in tests than deprived children, for instance.