Closing a rural school in Wales should only happen after councils have done "everything they can" to keep it open, according to new guidelines.
Changes to the School Organisation Code from Thursday include the presumption against the closure of rural schools.
Campaigners in some areas have accused councils of trying to rush closures through in recent months.
Education Secretary Kirsty Williams said all viable alternatives should be considered before closure.
This includes linking up with other schools.
The new code will be underpinned by 219 schools being designated and listed as rural for the first time. under the code.
You might be interested in these stories:
There have been campaigns on Anglesey against a series of closures and also in the Vale of Glamorgan.
Councils have faced the issue of cost pressures of maintaining smaller schools with surplus places in less heavily-populated areas.
But as well as assessing the impact of a closure on pupils' education and the wider community, they must now explain why closure is the "most appropriate" course of action.
In the Vale of Glamorgan, a month-long statutory consultation on plans to move pupils from Llancarfan Primary School to a new £4m "super primary" building five miles (8km) away in Rhoose starts next week.
There has been a school in the village since 1875. There are just over 100 pupils on the roll and the council estimates numbers will continue to fall.
But campaigners say the school is part of the fabric of the community and their plea for a decision on its future to be based on the new code "fell on deaf ears".
"We hoped the cabinet would respect and follow the recommendation to work with the community to explore alternatives to closure," said campaign spokesman Matthew Valencia.
"Disappointingly, it chose not to. And we said all along that any decision cabinet made going forward should be informed by the presumption against closure of rural schools."
The campaign has vowed to continue its fight, by legal action if necessary.
'Recognise and respect'
Vale of Glamorgan council has denied it is a school closure but said it is a transfer of pupils and that the current building is not fit for purpose.
"The first edition of the School Organisation Code came into force on 1 October 2013 and applied in respect of all school organisation proposals published by way of statutory notice on or after that date," said a spokesman.
"The second edition of the code comes into force on 1 November 2018, and comes into effect immediately subject to the following: if a proposer has commenced consultation before 1 November the proposal must be published and determined in accordance with the first edition of the code."
The Welsh Government said the presumption against closure is not retrospective, and does not apply to proposals that are already in progress including those where the consultation has been published.
Meanwhile, at Amlwch at Anglesey, proposals include an option which could see up to six local primary schools closing and sharing the building belonging to secondary school, Ysgol Syr Thomas Jones.
A spokesman for Anglesey council said it would "recognise and respect" the principles of the amended code and "encourage local communities to work with us to establish future educational arrangements which are built on improved effectiveness and efficiency".
But Plaid Cymru AM Rhun ap Iorwerth said the Welsh Government just wanted to give the "impression" that it was protecting rural schools.
"I welcome any genuine attempts to help smaller schools, but at the same time as this code is being developed, government policy is urging moves towards larger schools, and, crucially, a code not backed by additional resource is a smokescreen," he said.
"Welsh Government should be looking for ways to support councils in trying to find new and innovative ways of keeping schools open within their communities."
Ms Williams said the Welsh Government was "supporting pupils and teachers" in rural areas.
"This doesn't mean a rural school will never close, but it does mean that all options and suggestions are on the table before a decision is made," she said.
"This might include federation with other schools or increasing the community use of school buildings to make the school more viable."
The policy is part of an agreement which saw Ms Williams, the only Liberal Democrat AM, join the Labour-led Welsh Government as education secretary after the 2016 assembly election.