The Scottish Parliament building, which opened three years late and at £431m cost 10 times over budget, has won the Stirling Prize for architecture.
The Scottish Parliament's cost of £431m was 10 times over budget
It beat five other contenders including a library and new factories built for BMW and the McLaren Formula One team.
The prize honours the building which has made the biggest contribution to British architecture in the past year.
Last year the £20,000 award was won by London's "Gherkin", which was designed by Lord Foster.
Foster and Partners had hoped to win the prize for the second year running for their design for the McLaren Technology Centre in Woking, Surrey.
The judges described the building, which houses laboratories, testing facilities and electronic workshops in a 50-acre site, as "breathtaking".
But they chose the "remarkable architectural statement" of the Scottish Parliament in Edinburgh instead.
The building, designed by EMBT/RMJM Ltd, caused controversy because of its late opening and cost.
Its architect, the Spaniard Enric Miralles, died in July 2000, but his widow Benedetta Tagliabue attended the awards at the Museum of Scotland in Edinburgh.
The judges said the building "manifests itself as an attempt at an organic transition between the city and the drama of the Scottish countryside surrounding it" - an effect helped by its landscaping.
"The ability of both the design and construction teams to realise a building of this complexity is truly remarkable," they said.
BMW Central Building, Leipzig
Lewis Glucksman Gallery, Cork
Scottish Parliament, Edinburgh
McLaren Technology Centre, Woking
Jubilee Library, Brighton
Fawood Children's Centre, Harlesden
The Scottish Parliament's Presiding Officer George Reid, speaking after the event, said the award honoured all those involved in the creation of the Parliament.
"The judges have decided that Holyrood is not just a working legislature but a work of art constructed on a world-heritage site where the history and land of Scotland fuse together," he said.
The Parliament was one of six buildings shortlisted for the award which recognises the building which has made the greatest contribution to British architecture in the past year.
Other contenders included the £8m Jubilee Library in Brighton, which had been the joint favourite with McLaren's headquarters.
Designed by Bennetts Associates with Lomax Cassidy, it was said to be "a civic building of importance".
The judges described its glass façade as "imposing, dissolving at night to expose the powerful library interior".
The second car factory among the shortlist was the BMW Central Building in Leipzig, Germany, designed by Zaha Hadid Architects.
The judges praised its "nice conceit of half-finished Beamers gliding above your head on elevated conveyor tracks, making their silent stately way between the body shop and the paint shop".
The Lewis Glucksman Gallery at University College, Cork, by O'Donnell + Tuomey was praised as "almost picturesque".
The sixth contender, the Fawood Children's Centre in Harlesden, north-west London, was designed by Alsop Design Ltd.
It was called a "fine example of the beneficial effects of good architecture".
Previous winners include the Gateshead Millennium Bridge and a multi-coloured London dance centre.
The prize is named after the architect Sir James Stirling, who died in 1992.