Schools in Wales are facing a building repairs backlog estimated at more than pound;785 million, with some councils claiming they can only afford essential safety work.
Children's commissioner Peter Clarke described the state of some school buildings as "shameful" and said it was extremely unlikely that the Welsh Assembly would meet its 2010 target of every school being "fit for purpose".
A survey by TES Cymru has revealed a backlog of repairs in 14 of Wales's 22 council areas totalling more than pound;500m. Averaged out for the whole of Wales, that adds up to a repair bill in excess of pound;785m. Council estimates range from pound;87m in the Vale of Glamorgan to pound;60m in Powys and pound;25m in Gwynedd.
Even after clearing the backlog, millions more will be needed if schools are to be brought up to the standard required by the Assembly government by 2010. It envisages schools equipped for "modern teaching and a wider role in the community".
Cardiff alone needs pound;16.4m on top of a pound;51.5m repairs bill to comply with disability access laws, but admits it can only afford to do urgent safety work at present.
Graham Dalton, schools planning and development manager, said: "We need to keep schools operationally safe and that means dealing with things like heating failures, roof leaks and fire precaution work. We are reactive because we can only afford to do work that we cannot avoid doing."
Aside from emergency repairs, many Welsh schools still do not have adequate play areas, halls or dining facilities, and some still have outside toilets.
Local authorities receive an annual allocation for school building improvement from the Assembly which can only be used for that purpose. They also receive capital funding to help with building costs, but authorities can spend this on other building projects as well as schools, such as roads.
An Assembly government spokesperson said: "All authorities in Wales receive significant support for improvements to school buildings and facilities.
"We were committed to invest pound;560m between 2003 and 2007 to improve school buildings. This commitment has been more than met, with investment already standing at pound;629m. It is beginning to have an impact on the state of school buildings, though there is still significant work to be done."
Mr Clarke called on the Assembly to be more courageous in telling councils how to spend its funding and to ringfence more money for school improvements.
He added: "I've seen leaking roofs, sewers overflowing and no lifts in multi-storey school buildings. Children are being asked to sit in an environment which we would never ask adults to sit in. What sort of message is that sending out to them?"
Geraint Davies, of NASUWT Cymru, said: "We should be ashamed that too many teachers and children are working in accommodation that dates back not to the last century but to the 19th century."
Anna Brychan, director of the National Association of Head Teachers Cymru, said the repair bill was staggering and represented "a huge funding challenge which local authorities are finding next to impossible to solve".
She added: "As far as we are aware, this does not even include the cost of preparing school buildings for the foundation phase."
Many councils are considering school closures or amalgamations to remove surplus places, which also entail improvements to remaining schools.
Before Carmarthenshire launched its pound;100m school modernisation programme, 38 of its schools had mobile classrooms, 50 had no hall and 14 had outside toilets.
But Gruff Hughes, acting general secretary of the Welsh-medium union UCAC, is concerned that poor buildings could be used to close viable small village schools.
"We worry this is going to be used to persuade parents to move to a new school and close the small ones, instead of bringing the small ones up to standard," he said.