School pupils become less and less confident, and increasingly lacking in self-esteem, from the age of 11 onwards.
But pupils who are born outside Britain, or who speak English as a second language, are more likely to have higher levels of self-esteem than their white British classmates.
A study of more than 1,500 secondary pupils, conducted by the Centre for Research on the Wider Benefits of Learning, found that there was a steady decline in self-esteem from Year 7 onwards.
Teenagers' awareness of their own ability also declined from the beginning of secondary school onwards. It increased slightly in Year 12, before declining again in Year 13.
Similarly, pupils felt the greatest sense of belonging at school when they joined at the age of 11. This then tailed off significantly throughout the remainder of their time there.
The researchers said: "A possible interpretation is that students feel a sense of school belonging and support when they join the school in Year 7, then dissociate themselves more from school as they go through their early teens.
"At Year 12, those students who continue with their education may reidentify with the school, but this drops again in Year 13 as they prepare to leave."
Unexpectedly, pupils born outside Britain were more likely to have high levels of self-esteem than their British-born classmates.
Similarly, pupils whose first language was not English tended to have greater self-esteem, and a greater sense of belonging at school, than those who had been speaking English all their lives.
The researchers suggested that schools tended to direct support towards those who do not have English as a first language. They recommended that similar steps were taken to boost the confidence of English-speaking pupils, too.
In fact, pupils' levels of self-esteem had implications beyond their own happiness. Those with greater awareness of their own ability and efficacy, as well as a greater sense of belonging at school, tended to attend school more regularly and behave better than their classmates.
The researchers concluded: "Evidence suggests that children who enjoy school are also more likely to do well ... Finding ways to boost the self-esteem and sense of support and belonging of students who feel that they do not fit in could pay ... dividends."