Part imaginative conservation project, part crazy new build, Utrecht town hall is a fitting tribute to its late architect.
Utrecht town hall was a crazy building long before Catalan architect Enric Miralles got his hands on it. Begun in 1546 when three canal-side houses were requisitioned for civic purposes, it expanded over the centuries into a Gormenghast of architectural styles on the outside and an impossible, decaying labyrinth on the inside.

For more than 400 years, the city fathers dreamed of a town hall that would reflect the mercantile importance of their municipality – once one of Europe's richest towns, now the fourth city of the Netherlands – but the dozens of exorbitant proposals drawn up came to nothing.

Finally, five years ago, they ran out of patience with their motley edifice and launched an architectural competition to salvage what they could. In the resulting £12m redevelopment, completed just before Christmas, competition winner Miralles has made the most of the building's existing eccentricities and added a few of his own.

The project is as much a conservation exercise as a new building – but with a typically Dutch absence of nostalgia. "We didn't just want to restore a medieval building," said project manager Albert Hutschemaekers. "We wanted to reuse it, but show it's a historic building." Conservationists audited the various structures, grading them according to their importance. "Some parts they said we had to restore, others to reuse and some they didn't care." Miralles was thus free to demolish a swath of ramshackle medieval structures, freeing up enough space to slot in a new four–storey office wing and lay a modest square. He turned the building around 180° by switching the entrance from the southern canal frontage to the new piazza to the north.

He then extensively reused elements rescued during demolition so that new floors are held up by ancient beams, new doorways plugged with antique doors and facades peppered with salvaged stonework. "There's just one part of the building where we restored," says Hutschemaekers. "Everywhere else we took the materials out and put them back somewhere else." This architectural bricolage has resulted in a building that is by turns inspired, bizarre and hideous. Approaching from the square on a dark and foggy January afternoon, the freakish new wing looms like a ruin. A false concrete and brick facade is set with randomly placed stone window surrounds rescued during demolition. Behind this grotesque assembly, the curving facade proper – clad in zinc, brick, glass and recycled timber – juts progressively outward at each floor like an inverted staircase, propped on concrete columns.

The tilt is a romantic reference to the 17th-century Dutch vernacular, says project architect Marc de Rooij. "They tilted forwards slightly so the rain won't soak into the bricks." As if to complete the illusion of continuing collapse, a zig-zag tumble of pipes carries rainwater down from the folded zinc roof to splash into a concrete trough. A looping tube of steel, apparently tracing the path of a bouncing ball, gives the locals something interesting against which to chain their bicycles.

The wing is rounded off by two blank, curving brick rumps – a foretaste here of Miralles' Scottish parliament building in Edinburgh, where similar forms (the famous "upturned boats") will be the strongest identifying symbol.

Inside, the new wing is endearingly homely, preserving the higgledy-piggledy charm of the old: corridors curve and take unexpected turns; offices are irregular shapes. On each floor a central corridor divides the new offices on the east from the backs of refurbished buildings on the west, serving as multistorey back–alleys for officials. "It doesn't have a typical office layout," says de Rooij. "You can see very clearly how the building was built up of different houses." E E Spatial complexity is offset by a bargain-basement palette of materials, with bare plywood chipboard on the ceilings, veneer on the walls and cork tiles on the floors. "He made very complex proposals in his design forms, but he chose very cheap materials," says Hutschemaekers. Yet the job was clearly rushed, and fire and safety inspectors have recently ordered a succession of messy amendments.

More successful is the treatment of the eastern ceremonial wing, housing the debating chamber, wedding rooms and the historic central hall, the building's restored centrepiece. Previously, circulation within the building had been hampered by an "improvement" made in 1830: an austere classical facade was thrown around the central hall and the intervening void stuffed with a warren of boxy rooms.

Miralles gutted the void to create a triple-height circulation space, its walls dotted with paintings and artefacts tracing the history of the town. The modest glass entrance on the square delivers you directly into this space. From here, a covered external staircase ascends to an angular, cantilevered concrete bridge and back into the void, linking to a balcony supported on huge, retrieved beams.

The first-floor debating chamber is the democratic heart of the town hall and one of its most interesting spaces. Stripped-bare walls reveal centuries of alterations, with 500-year-old brickwork rubbing up against 20th-century patch-ups. The ceiling has been removed to create a sense of height and lightness but the medieval timbers are left in their original positions, supported on a steel lattice. "It's like a history book, and not only about the building," says Hutschemaekers. "It gives you a vision of what the city was." It is a terribly un-Dutch building, according to de Rooij, who hails from Rotterdam but now works in Miralles' home city of Barcelona. "The modern Dutch tradition is functional, very conceptual. It's much more about being brutal. Enric was far more sensitive; a very classical architect." Hutschemaekers agrees. "In Holland, architects work in two dimensions, with drawings. Enric works in a 3D way. He started with the model then worked towards the drawings. It was sometimes difficult; we had big arguments, but it didn't matter." The client–architect relationship was a lot smoother, Hutschemaekers says, than the stormy saga of the Scottish parliament building. "In Edinburgh there were a lot of committees trying to talk with the architect. Here we had a small [client] team. Enric told me that there were a lot of political committees in Edinburgh who told him what they wanted, then saw the cost, and said they didn't want it any more. You can't let the architect spend a year doing designs and then say you can't afford it." He confides that the project manager in Edinburgh phoned him shortly after Miralles won the parliament project to ask his advice. "He contacted me to ask how we organised the work with Enric.

I told them he was a marvellous architect but also that he was very strong to get what he wants. So you also have to be strong to ensure you get what you want, too." Miralles never lived to see the Utrecht building completed. He died of a brain tumour on 3 July last year, aged only 45, a month before the official opening of the building by Queen Beatrix, which was attended by Miralles' family. "It was a kind of family reunion," says Hutschemaekers, who developed a strong affection for the architect. "It is the first building after he died and it was his first complete work. He designed everything, including the furniture and the light fittings." The town hall, unique, unforgettable and slightly mad, stands as a memorial to an exuberant imagination.