Children who fall behind bright classmates at primary school can suffer a serious loss of confidence that holds them back for several years, it is claimed.

The study – by the London School of Economics – found that pupils’ relative ranking in the classroom up to the age of 11 had “sizeable, robust and significant effects on later academic achievement” at secondary school.

It emerged that boys were more likely to be affected by their position in lessons than girls.

The research, which was carried out by the LSE’s Centre for Economic Performance, challenges the assumption that being surrounded by high-achieving peers can drag up the performance of slower classmates.

Academics suggested that less intelligent pupils may actually be better off attending a “worse school” where they perform relatively well instead than being left behind in a high-flying institution.

It was claimed that the extra confidence associated with being at the top of the class was worth the equivalent of six months’ extra schooling compared with a low-ranked child.

The conclusions come despite repeated claims from supporters of mixed-ability schooling that placing all pupils in the same class had a positive effect on children at the top and bottom of the ability range.

The study said: “Imagine two pupils of the same high-ability: one is top of class but the other is in the middle as the school they attend attracts many high-ability students.

“The research finds that the pupil who was top of class performs better in secondary school and is more confident. The effect of rank is as important as teaching quality.”

Dr Felix Weinhardt, one of the report’s authors, said: “Our findings go against the common assumption that having better peers is always the best for children.

“Our study suggests that there are situations where your child will be better off from not going to the school with high-performing peers, especially for boys.”

The study was based on an analysis of the academic performance of more than two million pupils in English, maths and science. It also involved a survey of 15,000 children in which pupils were asked to rate how well they performed in each subject.

Researchers suggested that being in the 75th percentile or better at the end of primary school could give pupils a significant confidence boast – raising their academic attainment at the age of 14 – relative to another child in the 25th percentile.

The report found that boys were four times more affected by being top of class compared with girls, while poor pupils who receive free school meals a;sp gain more from being at the top than wealthier peers.

Richard Murphy, LSE research officer, who co-authored the paper, said: “While we cannot make every pupil top of class, our research highlights the importance of confidence in order to succeed.”

The study suggested that schools could focus on other strategies – beyond classroom ranking – to boost pupils’ confidence.

“The policy implication is that non-cognitive skills such as confidence, perseverance and resilience have large effects on achievement,” the paper said. “There are potentially many other interventions that could have positive effects on all individuals.”

The report said: “The importance of rank leads to a natural question for a parent deciding on where to send their child. Should my child attend “a ‘better school’ or a ‘worse school’ where she/he will be higher in the rank ordering?”

It added: "Our results also imply for individual parents that they should not always send their child to the ‘best’ school, if this would mean a low ranking for their child in that school.”