Sir David, whose previous wins include an Academy Fellowship lifetime achievement award in 1980, said: "Our thanks, of course, go to the spitting cobras, axolotls, golden frogs, dwarf chameleons, those happy tortoises, and this belongs not to me or to them but the production team."
He said he had no plans to retire and was "going off to Antarctica next to look at penguins".
Attenborough thanks the animals
The Bill, meanwhile, beat EastEnders, Casualty and Emmerdale to the continuing drama trophy, earning the ITV police show its first Bafta in 25 years.
Earlier this year, ITV announced that The Bill was being cut from two episodes a week to one.
EastEnders also lost out in the best actress category, where June Brown, who plays Dot Cotton, was the first soap star to be nominated since 1988.
The 82-year-old, who has played Dot Cotton (now Branning) since EastEnders' launch in 1985, was cited for a January 2008 episode in which she appeared alone.
But the best actress gong went to Anna Maxwell Martin for her role as a mental health patient in Channel 4's Poppy Shakespeare. She won the same award for Bleak House in 2005.
Stephen Dillane was named best actor for playing a grieving father in The Shooting of Thomas Hurndall, also on Channel 4.
Meanwhile, Wallander, starring Kenneth Branagh, was named best drama series, earning the actor his first TV Bafta - 20 years after he won a film Bafta for Henry V.
He said it was "marvellous" to win, and thanked the BBC for commissioning the programme, based on the detective novels by Swedish author Henning Mankell.
"They took a risk in wondering whether the world would be interested in the troubled life of a melancholy Scandinavian," he said.
Wallander beat Doctor Who, Spooks and Shameless to the award.
Comedy performance
Harry Enfield and Paul Whitehouse were given the best comedy programme trophy for their sketch show Harry and Paul.
Four-time winner Whitehouse congratulated Enfield, who had never won before. Enfield joked: "This time I made sure he was in the show so I might get at least a touch of it too."
The duo dedicated their award to their late producer Geoffrey Perkins, who died last year.
David Mitchell won best comedy performance for Peep Show, and thanked his comedy partner Robert Webb, who was not nominated.
Jennifer Saunders is "honoured" to receive the Bafta Fellowship with Dawn French
The best sitcom prize went to Channel 4's The IT Crowd, which was chosen above Peep Show, Outnumbered and The Inbetweeners.
BBC Four drama Hancock and Joan, about the life of comedian Tony Hancock, had led the way with three nominations - up for best single drama, best actor for Ken Stott, best actress for Maxine Peake.
But it lost out in all three categories.
Meanwhile, comedy duo Dawn French and Jennifer Saunders received Bafta's highest honour, the Fellowship.
They were the second double-act to receive the prestigious honour, following Morecambe and Wise, who were honoured in 1999.
The ceremony, hosted by Graham Norton in London, is the most prestigious night in the British TV calendar.
Bookmark with:
What are these?