Toldi Tamás was nursing a hangover when a wave of toxic sludge hit his family home. The night before he had won an election to become Devecser's third mayor since the fall of communism in Hungary. Champagne had flowed. But just hours later, on 4 October 2010, his phone was buzzing with messages from frightened locals. They kept mentioning a dam. "There is no dam," he told one caller.

There was a dam – six metre-high, a couple of miles away, that held back a reservoir of deadly "red mud", a caustic byproduct of aluminium extraction. But it had burst, and a million cubic metres of the slime was rushing toward Devecser, with waves of up to two metres. Within minutes the town was overcome: cars washed down streets and residents lay stricken on the roofs of their ruined homes. The "red mud disaster" claimed 10 lives, 150 were seriously injured.

An aerial view of the broken dyke of a reservoir containing red sludge from aluminium factory is seen near Ajka on 8 October 2010. Photograph: Balazs Mohai/AP

Three years later, Tamás is standing atop Devecser's parish hall looking out on a new park marking the ruined area. Next to it is a 30-hectare poplar copse whose trees are used to heat 87 homes built just eight months after the disaster.

A girl plays on a swing next to the newly built ecumenical chapel, designed by late Hungarian architect Imre Makovecz, in the eco housing estate built after the Ajka alumina plant accident in Devecser, Hungary. Photograph: Zsolt Szigetvary/EPA

From an environmental disaster zone, Devecser has become a model town for sustainable energy. It's something Tamas, who worked seven days a week and slept just three hours each night for two years after the flood, registers with muted pride.

His town is now at the forefront of a push for waste-to-energy systems. According to environmental consultants Ecoprog there are 2,200 waste-to-energy plants worldwide, with a disposal capacity of around 255m tons of waste per year. Another 180 will be built by 2017, adding 52m tons of capacity.

A political conservative whose family made their fortune in agriculture, Tamás has used the red mud disaster to reshape Devecser as a hub for green energy and local produce – combining cutting-edge technology with ancient nous. Each summer a team of 12 workers cuts down the poplars and puts them through two mulching machines, which cost Devecser €15,000 (£12,500) each.

The new development, designed for free by the late Hungarian architect Imre Makovecz, was part of a disaster relief that cost Victor Orbán's national government some 127bn Hungarian Forints. Only the bricks used to build the houses weren't sourced locally, a blot that clearly irks Tamás: a local brickmaker, whose factory billows beyond the new-builds, couldn't make bricks for Devecser's biting winter.

"For me it's very important to use a clean source of heating energy here," says Támas. "Secondly my concern was to use locally-available sources of energy. We shouldn't use natural gas from the Caucasus in a pipeline, but use the energy poplars or mulch, or local geothermal energy."

Geothermal energy – which makes use of heat in the Earth – has been put to use heating a bus terminus that throngs with locals at rush-hour. "The mayor is superhuman," says Jennervé Pál Szilvia, director of a local kindergarten.

Tamas doesn't think so. But he is committed to his cause, and hopes his methods can bring back locals who left for cities during socialist industrialisation. "I want to bring back the low-level, healthy farming techniques we had before. Then we can make it certain that all our public institutions use local produce. It's healthier than the stuff you can buy at Tesco."

This year the town is installing a solar vegetable dehydration plant, which will help spur demand for local produce even further. And the poplars are expected to turn in even more energy. "There's a long way to come before we can be a model of sustainability," says Tamás "But we need to start somewhere."