Scotland's education system stands up well to international comparisons, a wide-ranging report from Her Majesty's Inspectorate of Education has said.
The study draws together four years of inspections
Inspectors found many young people did well at school, but called for a drive to tackle the under-performance of a significant minority.
It is the first time the system has been examined from pre-school nurseries to further education colleges.
The report is based on individual inspections over the past four years.
The Improving Scottish Education report said that parents and pupils had "confidence" in the education system.
It praised the overall quality of the curriculum and the commitment of staff.
However, it highlighted a number of challenges facing education.
It said there was a "considerable variation" in performance between education authorities and found unacceptable differences in the quality of teaching from class to class at individual schools.
HM senior chief inspector Graham Donaldson said: "There is considerable variation in performance across education authorities and some have much work to do to match the standards of the best."
He added: "As yet, we have not seen sufficient improvement in leadership overall. We are still reporting important weaknesses in leadership across all formal education sectors."
Mr Donaldson said more than 15% of head teachers were attaining "unsatisfactory" or just "fair" standards and this was not good enough.
He also said that one in five adults reported difficulties with literacy and numeracy, while too many young people aged 16 to 19 were not in education, employment or training.
"That is a loss both for the individual concerned and to society more widely," he said.
On pre-school education his report found that the quality of leadership, particularly in "a substantial number" of private and voluntary sector nurseries was not up to scratch.
He also said there was room for improvement in the quality of learning in nurseries generally but praised the commitment and calibre of staff and their close relationship with parents.
At primary school level, although pupils were keen to learn, some were being let down by inconsistency in the quality of learning and headteachers, the report found.
At secondary school level he said there was room for improvement in leadership at all levels, from headteachers to local authority education directors.
And lower attainment among pupils, particularly boys and especially at S1/S2 level, needed to be corrected, the report said.
In the college sector the report noted there was room for improvement on student retention and achievement and better information technology was needed.
But he praised colleges for their tailored courses, good links with employers and promotion of life-long learning.