An apparently spontaneous remark by the Queen ahead of the Scottish independence referendum was “a deliberate last-minute intervention” designed to persuade people to vote no, according to the latest extracts from Lord Ashcroft’s controversial biography of David Cameron.

The book, Call Me Dave, which was written with journalist Isabel Oakeshott, describes how the Prime Minister suffered sleepless nights and his wife Samantha’s hair started falling out as he became increasingly worried that the pro-independence camp might win.

It describes a “strained” breakfast at Balmoral Castle with the Queen, who pointed to a newspaper headline saying: “Yes vote leads in Scots poll.”

According to the serialisation in The Daily Mail, a “friend” of Mr Cameron is quoted as saying: “One of his normal characteristics is the ability to stay completely calm when everyone is panicking. This is one of the few times he didn’t do that.”

Mr Cameron later called his pollster, Andrew Cooper. “He was very worried. It was the first time he was seriously contemplating: s***, we might lose,” Mr Cooper said.

Queen Elizabeth II: Life in pictures Show all 50 1 /50 Queen Elizabeth II: Life in pictures Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II on a walk-about in Portsmouth during her Silver Jubilee tour of Great Britain, 1977 Queen Elizabeth II: Life in pictures Queen Elizabeth II The future Britain's Queen Elizabeth II (R) pictured with her younger sister Princess Margaret (L) in 1933 AFP/Getty Images) Queen Elizabeth II: Life in pictures Queen Elizabeth II The 9-year-old Elizabeth attends an aristocratic wedding with her mother and younger sister. Later in that year with the death of her Grandfather and the Abdication of her Uncle Edward VIII she became first in line to the throne, 1936 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II The coronation of King George VI in 1937, Elizabeth aged 10 became the heir apparent to the throne Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II Elizabeth and her sister arrive at Waterloo station to say goodbye to their parents as they leave to tour Canada. Elizabeth was thought too young to escort her parents on the tour and was described as "tearful" as they departed. She and her parents made the first ever transatlantic telephone call during their time away, 1939 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II The 13-year-old Elizabeth and her sister Margret address children who have been evacuated from the cities on BBC's 'The Chilrens Hour' She said "We are trying to do all we can to help our gallant sailors, soldiers and airmen, and we are trying, too, to bear our share of the danger and sadness of war. We know, every one of us, that in the end all will be well", 1940 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II Just before the end of the war Elizabeth took part in training to become an ATS officer. She is pictured learning to change a tire, 1945 AFP/Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II The official announcement of Princess Elizabeth and Phillip Mountbatten's engagement. The pairing was incredibly controversial as Prince Phillip had no financial standing and he was foreign born, the prince of Denmark and Greece (though he served Britain in the war and was given British Citizenship), 1947 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II (in coach) and her husband Prince Philip, Duke of Edinburgh are cheered by the crowd after their wedding ceremony, on 20 November 1947, on their road to Buckingham Palace, London Queen Elizabeth II: Life in pictures Queen Elizabeth II Elizabeth smiles at her first child, a month old Prince Charles. Charles was born on 14 November 1948 Corbis Queen Elizabeth II: Life in pictures Queen Elizabeth II The couples second child Princess Anne was born in 1950 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II Arriving back in England upon hearing the death of her father King George VI. The Kings health had been in decline for a number of years and Elizabeth had been filling in for him on an official visit to Australia by way of Kenya. As his heir Elizabeth became Queen aged 26 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth's coronation took place on 2 June 1953. It was the first ever coronation to be aired live on television, being one of the most watched events in history with millions gathering around their TV sets to see the new monarch Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II standing next to her daughter Princess Anne, 1960 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II President Eisenhower (centre) with the British Royal family (L-R) Prince Philip, Princess Anne, HM Queen Elizabeth, Prince Charles and Captain John Eisenhower, at Balmoral Castle, Scotland, 1959 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II as she turns to smile and talk to an unidentified officer, during the Trooping of the Colour by the First Battalion of the Jamaica Regiment at Up-Park Camp, Kingston, Jamaica, 1966 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II walking cross country at the North of Scotland Gun Dog Association Open Stake Retreiver Trials in the grounds of Balmoral Castle in 1967 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II during her visit to the Chelsea Flower Show in London, a regular fixture in the royal calendar, 1971 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II and the Duke of Edinburgh during their traditional summer break at Balmoral Castle. The highland retreat is one of the Queen's favourite places, each year, she heads off to Scotland for the summer. "It is rather nice to hibernate for a bit when one leads such a moveable life," she once said, 1976 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II during a walkabout in Muscat while visiting Oman, 1979 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II with some of her corgis walking the Cross Country course during the second day of the Windsor Horse Trials. The monarch is responsible for introducing a new breed of dog known as the "dorgi" when her corgi Tiny was mated with a dachshund "sausage dog" called Pipkin which belonged to Princess Margaret, 1980 Queen Elizabeth II: Life in pictures Queen Elizabeth II (L-R) the Queen Mother, Queen Elizabeth II, Prince William, Prince Harry and the Prince and Princess of Wales after the christening ceremony of Prince Harry, 1984 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II taking the salute of the Household Guards regiments during the Trooping of the Colour ceremony in London, 1985 Queen Elizabeth II: Life in pictures Queen Elizabeth II Diana, Princess of Wales and Queen Elizabeth II as they smile to well-wishers outside Clarence House in London, 1987 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II, with Chief Instructor, Small Arms Corp LT Col George Harvey, firing the last shot on a standard SA 80 rifle when she attended the centenary of the Army Rifle Association at Bisley, 1993 Queen Elizabeth II: Life in pictures Queen Elizabeth II South Africa's President Nelson Mandela greets Queen Elizabeth II as she steps from the royal yacht Britannia in Cape Town at the 1995's official start of the her first visit to the country since 1947 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II smiles as she visits Bowring Park in St. John's, Newfoundland, on the third day of a 10-day official visit to Canada, 1997 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen accompanied by the Duke of Edinburgh make their way into St. George's Chapel at Windsor for the annual Garter ceremony, 1999 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II and Pope John Paul II as they meet at the Vatican, 2000 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II and the Queen Mother leaving church by horse drawn carriage on the Sandringham Estate, Norfolk, 2000 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth rides her horse in the grounds of Windsor Castle, 2002 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth arrives for the world premiere of James Bond movie "Casino Royale" at the Odeon cinema in Leicester Square in London, 2006 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth boards a scheduled train at Kings Cross station in London, 2009 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II planting a tree at Newmarket Animal Health Trust, during a royal visit which marked her 50th year as the charity's patron, 2009 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II talking with Pope Benedict XVI during an audience in the Morning Drawing Room at the Palace of Holyroodhouse in Edinburgh during a four day visit by the Pope to the UK, 2010 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II visiting the Sheikh Zayed Mosque in Abu Dhabi, United Arab Emirates, 2010 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II receives flowers from the crowd during her visit to Federation Square in downtown Melbourne, 2011 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth watches a preview of her Christmas message wearing a pair of 3D glasses, studded with Swarovski crystals in the form of a "Q", at Buckingham Palace in central London, 2012 Queen Elizabeth II: Life in pictures Queen Elizabeth II Members of Britain's royal family (front L to R) Prince Philip, Queen Elizabeth and Prince Charles cheer as competitors participate in a sack race at the Braemar Gathering in Braemar, Scotland, 2012 Queen Elizabeth II: Life in pictures Queen Elizabeth II Britain's Prince Charles kisses the hand of his mother Queen Elizabeth at the end of her Diamond Jubilee concert in front of Buckingham Palace in London, 2012 Reuters Queen Elizabeth II: Life in pictures Queen Elizabeth II Catherine, Duchess of Cambridge laughs as Queen Elizabeth gestures during a visit to Vernon Park in Nottingham, 2012 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II and Prince Philip attend a service for the Order of the British Empire at St Paul's Cathedral in London, 2012 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II meets young people during an official visit to The Shard building in central London, 2013 Queen Elizabeth II: Life in pictures Queen Elizabeth II Actress Angelina Jolie is presented with the Insignia of an Honorary Dame Grand Cross of the Most Distinguished Order of St Michael and St George by Queen Elizabeth II in the 1844 Room at Buckingham Palace, London, 2014 Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II and Prince Philip, Duke of Edinburgh visit the Blood Swept Lands and Seas of Red evolving art installation at the Tower of London, 2014 Queen Elizabeth II: Life in pictures Queen Elizabeth II The Queen and the Duke of Edinburgh at the State Opening of Parliament, 2015 AFP/Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II (L-R) Britain's Princess Anne, Princess Royal, Camilla, Duchess of Cornwall, Prince Charles, Prince of Wales, Prince William, Duke of Cambridge holding his son Prince George of Cambridge, Catherine, Duchess of Cambridge, Queen Elizabeth II, Prince Harry (back), Prince Andrew, Duke of York (back), James, Viscount Severn (front), Princess Beatrice of York (back), Prince Philip, Duke of Edinburgh and Princess Eugenie of York (back) stand on the balcony of Buckingham Palace waiting to view the fly-past during the Queen's Birthday Parade, 'Trooping the Colour,' in London, 2015 Queen Elizabeth II: Life in pictures Queen Elizabeth II The Trooping of the Colour is an annual celebration marking the Queen's birthday, 2015 Getty Queen Elizabeth II: Life in pictures Queen Elizabeth II Britain's Queen Elizabeth II stands with Kate the Duchess of Cambridge whilst pushing Princess Charlotte in a pram as they leave after attending the Christening of Britain's Princess Charlotte at St. Mary Magdalene Church in Sandringham, 2015 AP Photo/Matt Dunham, Pool Queen Elizabeth II: Life in pictures Queen Elizabeth II Queen Elizabeth II arrives at the Broadway Theatre in Barking, 2015 Tim P. Whitby/Getty Images

The book says that the Queen was “deeply troubled” by the prospect of Scotland leaving the United Kingdom.

“Inside Whitehall, there were discussions on whether she could somehow speak out against Scottish independence while remaining within the constitutional boundaries of neutrality,” it says.

“Under a cloak of secrecy, the Cabinet secretary, Sir Jeremy Heywood, and the Queen’s private secretary, Sir Christopher Geidt, held talks to work out how she might express her concerns in a suitably coded way. The result was a remark overheard after a Sunday service in Crathie Kirk, the small church that the Royals attend when staying at Balmoral.

“‘I hope people will think very carefully about the future,’ the Queen was reported to have said — to the delight of the No camp.

“The carefully chosen words were no accident. Her supposedly off-the-cuff remark was a deliberate last-minute intervention — and it left no one in any doubt about which side she was on. Cameron was undoubtedly deeply grateful.”

Mr Cameron feared he would have to resign as Prime Minister, but also that he would be remembered for one thing alone.

A confidant is quoted as saying: “­Funnily enough, I think it was less ‘we’re going to have to move out’ [of Downing Street] than the fact that, for the rest of his life, he’d be the Prime Minister who lost the United Kingdom. He was saying: ‘I’ll be remembered for this till the day I die.’”

The book says Mr Cameron gathered a team to plan a response if Scots voted yes.