By Andrew Osborn and Sarah Young
LONDON (Reuters) - Britain gave Margaret Thatcher its grandest political funeral in half a century on Wednesday as her flag-draped coffin was borne through central London on a horse-drawn gun carriage, though a few boos were a reminder of her divisive rule and legacy.
In an event comparable to Winston Churchill's funeral in 1965, the Queen joined top British and foreign politicians past and present to pay her final respects to the "Iron Lady" who - for better or for ill - transformed the country.
Thousands of supporters lined the streets of London as Thatcher's casket made its final journey from the centre of British political power in Westminster to St Paul's Cathedral.
Honoured with a gun salute from the Tower of London every minute and the silencing of the bells of Big Ben, military bandsmen played Beethoven, Mendelssohn and Chopin. More than 700 military personnel and thousands of police provided security.
Thatcher, who ruled Britain from 1979-1990, died after suffering a stroke on April 8. She was the country's first and only woman premier, its longest-serving prime minister of the 20th century, and won three consecutive general elections.
She sought to arrest Britain's post-war decline by smashing the trade unions and privatising Britain's national assets, while boosting home ownership and the services sector.
More than 20 years later, her supporters view her as a modernising champion of freedom, while her foes accuse her of destroying communities and of ushering in an era of greed.
As a bell mournfully tolled, a party of soldiers and sailors carried her casket on their shoulders into St Paul's Cathedral.
Beneath its giant painted dome - the same place where Horatio Nelson's funeral was held and Prince Charles and Lady Diana Spencer were married - more than 2,000 mourners then heard a sombre service filled with hymns and reflective readings.
"After the storm of a life lived in the heat of political controversy, there is a great calm," the Bishop of London, Richard Chartres, told mourners. "There is an important place for debating policies and legacy ... but here and today is neither the time nor the place."
In death, as in life, Thatcher polarises opinion.
While the vast majority of onlookers clapped her cortege as a mark of respect and threw blue roses into its path, some chanted "Ding dong the witch is dead" and about two dozen opponents turned their backs on the procession.
One man held up a placard reading "Boo!" and some shouted "scum". In contrast, Chancellor George Osborne had to wipe away his tears during the funeral service.
'I VOW TO THEE MY COUNTRY'
The Bishop of London brought smiles to the faces of former leader Tony Blair, Prime Minister David Cameron's wife Samantha and other mourners when he recounted a story about her telling him not to eat duck pate because it was fattening.
Cameron and Amanda, Thatcher's 19-year-old granddaughter, read from the New Testament while patriotic hymns echoed around the imposing 300-year-old cathedral.
Two heads of state, 11 serving prime ministers and 17 foreign ministers looked on. Former U.S. Secretary of State Henry Kissinger also attended. The music included Thatcher's favourite hymns, among them "I Vow to Thee My Country".
British military bandsmen played Beethoven, Mendelssohn and Chopin to accompany the grandest funeral for a British politician since that of Thatcher's hero, Churchill, in 1965.
Polls have shown that many Britons are unhappy that the estimated 10-million-pound ($15 million) bill for the ceremonial funeral is being picked up by the taxpayer at a time of austerity and spending cuts.
But Cameron dismissed such criticism.
"She was the first woman prime minister, she served for longer in the job than anyone for 150 years, she achieved some extraordinary things in her life," Cameron, the Conservative Party leader, said.
"What is happening today is absolutely fitting and right," the prime minister added.
People gathered along the funeral procession route early in the morning with placards that reflected a range of views.
"You gave millions of us hope, freedom, ambition," one read. Another said: "Over 10 million pounds of our money for a Tory funeral." Tory is another word for Conservative.
"This country was pretty well down on its knees in the '70s," said Roger Johnson, among the admirers lining the pavement in central London.
"Margaret Thatcher came along and sorted everything out. Her legacy is that she put the word 'great' back into Great Britain," he said.
There were notable absences. Former Soviet leader Mikhail Gorbachev and Nancy Reagan, the widow of Thatcher's great U.S. friend and ally Ronald Reagan, were too frail to attend.
The guest list for her funeral has prompted talk of diplomatic snubs. The United States did not send a senior figure from President Barack Obama's administration.
Argentina's ambassador refused to attend after Britain failed to invite Argentine President Cristina Fernandez, at the Thatcher family's request, amid renewed tensions over the Falkland Islands.
Relations have been strained since the 1982 war, when Thatcher ordered a task force to retake the South Atlantic territory after Argentinian troops seized it.
Thatcher's body was due to be cremated later on Wednesday and her ashes placed alongside those of her late husband Denis in southwest London.
Her supporters say they want to raise funds for a library and study centre dedicated to her beliefs and erect a statue of her in a prominent place in London, a thought that horrifies her ideological opponents.
The abiding domestic images of her premiership will remain those of conflict - police confrontations with massed ranks of coalminers whose year-long strike failed to save their pits and communities, Thatcher riding a tank in a white headscarf, and flames rising above Trafalgar Square in riots over the unpopular "poll tax" which contributed to her downfall.
Cameron said Thatcher's battles, particularly her crushing of strike-prone trade unions, had reduced divisions.
"She was a bold politician who recognised the consensus was failing ... She took tough and necessary decisions and in many ways created a new consensus," he said.
Even Thatcher's critics concede that she transformed the face of Britain, albeit in a way they loathe.
In 1979, when she came to power, Britain was in the grip of a long post-war decline with troubled labour relations and low productivity and was being outperformed by continental rivals France and Germany.
She turned that around, but the price in growing inequality and the closure of large swathes of Britain's industrial base left parts of the country struggling to create new jobs and rebuild communities, leaving a bitter taste which endures.
The Bishop of London said her funeral was a time to put politics to one side.
"Lying here, she is one of us, subject to the common destiny of all human beings," he said.
(Writing by Guy Faulconbridge, Andrew Osborn and Estelle Shirbon; Additional reporting by Maria Golovnina, Kate Holton, Peter Griffiths, Estelle Shirbon, Costas Pitas, Dasha Afanasieva and Shadia Nasralla; Editing by Michael Roddy)