The message, which began "To President Obama", read: "I have been deeply shocked and saddened to learn of the dreadful loss of life today in Newtown, Connecticut; particularly the news that so many of the dead are children. Prince Philip joins me in extending our heartfelt sympathy to you and the American people at this difficult time.

"The thoughts and prayers of everyone in the United Kingdom and throughout the Commonwealth are with the families and friends of those killed and with all those who have been affected by today's events." The message was signed Elizabeth R.

Mr Cameron took to Twitter to say he was "devastated" by the Connecticut shootings and described the death of so many children as "truly heartbreaking". The Prime Minister later issued a statement, saying: "I was shocked and deeply saddened to hear about today's horrific shooting at Sandy Hook Elementary School in Connecticut that has killed and injured so many innocent people," he said.

"My thoughts are with the injured and those who have lost loved ones. It is heartbreaking to think of those who have had their children robbed from them at such a young age, when they had so much life ahead of them. I offer my sincere condolences to the families, to president Obama, governor (Dannel) Malloy and the American people. The thoughts of the British people are with you all at this very difficult time."

Mr Obama wiped tears from his eyes as he told the nation: "Our hearts are broken today." In an emotional televised address from the White House, he said: "I offer governor Malloy my condolences on behalf of the nation, and made it clear he will have every single resource that he needs to investigate this heinous crime, care for the victims, counsel their families.

"We endured too many of these tragedies in the past few years. And each time I learn the news, I react not as a president, but as anybody else would - as a parent. And that was especially true today. I know there is not a parent in America who doesn't feel the same overwhelming grief that I do. The majority of those who died today were children. Beautiful little kids between the ages of five and 10 years old."

CNN host Piers Morgan invoked the memory of the Dunblane massacre, where 16 schoolchildren and one teacher were killed by gunman Thomas Hamilton in the Scottish town in 1996. "This is America's Dunblane," Morgan wrote on Twitter. "We banned handguns in Britain after that appalling tragedy. What will the US do? Inaction not an option."

The Vatican said Pope Benedict XVI conveyed "his heartfelt grief and the assurance of his closeness in prayer to the victims and their families, and to all those affected by the shocking event", in a condolence message to the diocese in Connecticut that includes Newtown.