‘This pier,” said the Earl of Granville, when he opened Hastings Pier in 1872, “appears to me to be a peerless pier – a pier without a peer – except, perhaps, the unfortunate peer who is now addressing you.” Now, 145 years on, after a chequered life of spectacular fires and reincarnations of mixed success, Hastings Pier has once again been declared peerless – as the winner of the 2017 RIBA Stirling prize for the best building in the UK.

The structure is a far cry from the elaborate confection that impressed the Earl, a classic piece of seaside Victoriana designed by pier supremo Eugenius Birch, encrusted with twinkling lights and crowned with a Moorish pavilion. Instead, visitors to the seaside town are greeted by a stark wooden deck thrust out over the sea. Nicknamed The Plank, it eschews the usual kiss-me-quick seaside clutter (plenty of which can be found further along the beach), in favour of a neutral platform to host a range of different activities. Well supplied with electricity and other services, it is a blank canvas for the lively programme of bouncy castles, carousels and concerts. When not in festive mode, it is a powerful expanse, a place that is free to enter where you can hover above the water, inhale the sea air and take in the epic views.

Echoes of Capri … the Stirling-winning design. Photograph: Francesco Montaguti/dRMM

Hastings Pier is the work of London-based architects de Rijke Marsh Morgan, who have been shortlisted for the Stirling on two previous occasions: in 2010 for a colourful primary school in Clapham, London, and last year for a housing scheme in the controversial redevelopment of the Heygate Estate in the borough of Southwark. In Hastings, they have thankfully shown a greater sensitivity to the local community.

“dRMM’s role has been utterly pivotal in realising this masterpiece of subtle, effortless design,” said the Stirling judges. “They have driven this project through to completion: campaigning, galvanising and organising local support throughout each aspect of the funding stage. They went above and beyond what most people think of as the role of the architect – and then they kept going.”

Following a dramatic fire in 2010, after which the pier’s Panama-registered owner, Ravenclaw Investments, failed to respond, the council compulsory purchased the ruined carcass for £1 and entrusted it to the Hastings Pier Charity. dRMM won the design competition and began a seven-year collaboration, launching a crowdfunding campaign that raised £590,000 of the £14.2m cost, the rest coming from the Heritage Lottery Fund. It might be a fraction of the overall budget, but it has given locals a sense of ownership, earning it the title the people’s pier.

Epic views … town and sea seen from the pier. Photograph: Alex de Rijke

As empty decks go, it is a refined one. A small pavilion pops up in the middle, housing a cafe and community space, with a generous staircase leading up to a rooftop belvedere, which doubles as seating for concerts and puppet shows. The architectural cognoscenti will spot a nod to Casa Malaparte, a 1930s villa on a rocky outcrop in Capri that architects drool over.

There is a similar care for detail. It is clad in timber planks reclaimed from the original fire-damaged deck, fitted in a zigzag pattern. They have also been used to create new furniture, manufactured nearby as part of a local employment initiative. But the real genius was not doing the obvious thing, namely placing the building at the end of the pier. Instead, it is left open, like the deck of a ship, from where you can gaze down at some of the original rusting columns.

The pier, which also won the Stirling prize’s public vote, was the most obviously appealing building on an unadventurous shortlist. For the craft of architecture alone, 6a Architects’ elegant concrete studio for photographer Juergen Teller was the standout on the shortlist, but its private nature and rarified quality made it a hard sell.

The City of Glasgow College, by Reiach & Hall and Michael Laird, was the most impressive resolution of a fiendishly complex set of requirements – managing to fit all the functions of a city inside a gleaming 60,000-square-metre temple of vocational skills. But perhaps the final product smelled too much of Private Finance Initiative for the judges.

The shortlist … clockwise from top left, Hastings Pier, City of Glasgow College, a studio for photographer Juergen Teller, Command of the Ocean, the British Museum extension and Barrett’s Grove. Composite: RIBA Stirling prize

Rogers Stirk Harbour and Partners’s British Museum extension squeezes essential back-of-house conservation labs into a tricky corner site, but it occupied a place on the shortlist that arguably should have gone to Tate Modern’s much more daring Switch House. Meanwhile, Command of the Oceans, a new visitor centre at the Chatham Historic Dockyard by Baynes and Mitchell, was always an outsider, but the architects showed rare skill in the subtly of their intervention in the group of historic boat sheds.

Finally, Amin Taha’s Barrett’s Grove housing in Stoke Newington, London, is certainly a nice block of flats, but it would have been a more powerful statement to celebrate one of the model examples of new local authority-led housing that is finally being built around the UK, after years of councils being prevented from doing so.

For its ingenuity and public-minded story, Hastings Pier makes a worthy winner. As the judges said: “It is a project that has evolved the idea of what architecture is – and what architects should do.”

