More than 80 firefighters have worked through the night to tackle a "complex" blaze at a secondary school in Fife.
The fire at Woodmill High School in Dunfermline has been fought by 15 fire appliances since the alarm was raised at about 17:05 BST on Sunday.
There are no reports of injuries but Fife Council said the school would be closed and pupils should stay at home.
The school's head teacher Sandy McIntosh tweeted that staff were "devastated" by what had happened.
We are all utterly devastated by what has happened to our school. I will be meeting with our teachers and school staff this morning, along with staff from the Education Service and wider Fife Council to put in place plans for our young people. Mr McIntosh— Woodmill High School (@WoodmillHigh) August 26, 2019
The Scottish Fire and Rescue Service has asked people to avoid the area to allow access by the emergency services.
Deputy assistant chief officer Stuart Stevens, the incident commander, said: "We have worked through the night in challenging conditions to contain this fire and prevent further spread within the building.
"Through effective planning, we have now surrounded the fire and we are working to extinguish the flames.
"However, this remains a large and complex incident and we will remain in attendance for some time."
He added: "Our advice remains that members of the public should avoid the area to allow access for emergency service vehicles.
"I would like to thank our partners, the community and our firefighters for their professionalism and dedication as we work to bring this incident to a safe conclusion."
Crews remained on the scene on Monday morning as the damage to the building was revealed in the daylight.
Deputy First Minister John Swinney tweeted his support: "Terribly sorry with the news @WoodmillHigh. @scotgov has been in contact with @FifeCouncil and will discuss next steps. Good wishes to all in the school community at this tough time."
Fay Sinclair, convener of Fife Council's education and children's services committee said the fire had spread from the additional support needs department to the main building.
She told the BBC's Good Morning Scotland programme: "The council's emergency teams will be meeting this morning to look at what are the options here. We're talking about 1,400 pupils displaced from the school, at least for the short term."
Ms Sinclair said it would be difficult to transfer pupils to other nearby schools as many were already at full capacity.
"Dunfermline has been a rapidly growing town over recent years. All of the schools are very full, so there's not an immediate place to move these pupils to.
"The teams will be meeting today, the head teacher will be meeting all the staff today to look at how we can get these pupils accommodated as quickly as possible."