Each year The Herald’s exam league tables are greeted with a mixture of celebration and concern.

Schools such as Jordanhill, in Glasgow, who regularly feature at the top are rightly proud of the efforts of staff and pupils.

But some secondaries who don’t feature so highly argue the tables do not provide an accurate representation of the incredible work they do to provide for the future of all pupils, regardless of academic ability.

On the face of it our benchmark of the percentage of pupils at a school who pass five or more Highers appears a good one to judge a school’s performance. However, there are significant caveats.

Crucially, the resulting percentage is not a pass rate for the school. The figure provided by the Scottish Government represents the percentage of the total S4 roll who went on to secure five Highers - including those who didn’t sit Highers at all.

That means schools such as those in the suburbs of East Renfrewshire are always likely to appear at the top of league tables because a majority of pupils in S4 go on to take Highers.

Read more: Revealed: The top 50 state schools in Scotland 2019

Research tells us repeatedly that the factor that has the single biggest impact on exam results is deprivation, and this is clearly seen in our tables.

Poverty has an impact on attainment from birth, meaning pupils from disadvantaged backgrounds fall behind early on in terms of literacy and numeracy and continue to lag behind because of the range of social problems they experience as they grow up.

It is no accident, therefore, that schools in areas with very significant levels of deprivation are almost always lower down the league tables than those in middle class areas.

Many of the top 50 state schools in Scotland according to our tables have no pupils at all from the most deprived backgrounds. Some schools lower down have more than 80 per cent of pupils experiencing disadvantage.

Armed with this information our league tables tell us something very significant about the impressive work of many schools serving disadvantaged communities.

St Andrews School, in the east end of Glasgow, is a case in point with 75 per cent of pupils from the most disadvantaged communities, but 36 per cent going on to secure five or more Highers.

The national data from the league tables is also interesting because it shows how difficult it will be for the Scottish Government to achieve its stated aim of closing the poverty-related attainment gap.

Read more: In full: How every secondary school in Scotland ranks in exam league table

This year’s figures show disadvantaged pupils have done better than ever before, with a 1.4 per cent improvement in average overall attainment.

However, because pupils from the most affluent neighbourhoods have seen attainment rise by nearly two per cent, the attainment gap is actually getting wider on this measure.

Mark Priestley, professor of education at Stirling University, said improvement in the performance of the poorest pupils was welcome, but closing the gap was difficult to achieve through education alone.

He said: “When additional resources are put into schools in disadvantaged neighbourhoods to improve performance it may not be surprising that pupils from other backgrounds also benefit.

“But education is not a magic bullet and the impact of poverty has to be tackled with wider measures.”