New laws to safeguard rural schools in Scotland are expected to be passed by the Holyrood parliament later.
The Schools (Consultation) Bill aims to toughen the procedures which councils must follow when proposing any major education changes.
Ministers said the move would protect small, fragile local economies and communities.
The SNP manifesto had pledged to bring in a legislative presumption against the closure of rural schools.
The issue of rural school closures has caused public concern across the UK, although councils argue that keeping schools with low pupil numbers open is difficult to justify.
More than half of Scotland's primaries and secondaries combined are classed as rural.
The legislation sets out a series of requirements which local education bosses would have to follow when proposing changes.
Local authorities would have to publish and advertise the proposals and hold a consultation for at least six weeks of term time - although these would not need to run consecutively.
Education inspectors would also have to give their views on changes, while pupils and teachers would get more of a say.
A report on the proposals would then have to be released, with a block on councils being able to make their final decision until at least three weeks after its publication.
The bill would also replace the need for certain council decisions to be referred to the government, with a ministerial power to call them in where local authorities fail to comply with the legislation.