David Cameron has revealed that he suggested to the Queen’s private secretary how the monarch could influence the outcome of the 2014 Scottish independence referendum, before she went on to make an intervention that was widely seen as helping a faltering pro-union campaign.

Cameron, as prime minister, was on a weekend break at the Balmoral estate in the Scottish Highlands in September 2014 when a YouGov survey put the campaign for Scottish independence in the lead for the first time.

In the second part of a BBC series about his life in politics, which is to be broadcast next week, Cameron says the poll hit him “like a blow to the solar plexus” and led to “a mounting sense of panic”.

He says: “I remember conversations I had with my private secretary and he had with the Queen’s private secretary and I had with the Queen’s private secretary, not asking for anything that would be in any way improper or unconstitutional, but just a raising of the eyebrow, even you know a quarter of an inch, we thought would make a difference.”

The equivalent of a raised eyebrow came a week later when, outside Crathie Kirk, the church where the Queen attends Sunday services while at Balmoral, a woman disclosed in widely reported remarks that the monarch had offered a coded warning about the impending referendum, telling her: “Well, I hope people will think very carefully about the future.”

While the Guardian has reported that Sir Jeremy Heywood, then cabinet secretary, and Sir Christopher Geidt, then the Queen’s private secretary, had discussed how she might register her concern at the prospect of a yes vote for independence while remaining “impartial”, Cameron’s remarks are an explicit admission that he sought intervention.

The remarks are likely to be provoke the ire of Scottish nationalists.

Pete Wishart, a Scottish National party MP, said there was no doubt the Queen’s remarks had an impact on Scottish voters, particularly those who had not decided which way to vote.

“We knew Cameron was up to something at the time and for him to explicitly chronicle how he approached it, almost strategically, is almost beyond belief,” Wishart said.

The revelation is potentially the most controversial element of the programme Cameron Years, the first episode of which will be broadcast on Thursday with a focus on the lead-up to the referendum on Britain’s EU membership.

George Osborne, chancellor of the exchequer in Cameron’s government, is particularly critical of Cameron’s approach, saying: “David Cameron was just one of a number of British prime ministers who had fed this idea that we were different than Europe, that Brussels was to blame, and that the public ultimately had to have a say – and we’ve all paid a price for it in my view.”

Scottish independence: poll reveals who voted, how and why Read more

Osborne and Cameron have also spoken openly about the increasingly fraught attempts to convince Michael Gove to be on their side. Gove tells the programme that he felt “some of the conversations we had were attempts on his part to reassure himself that our friendship would mean that I wouldn’t stray from the fold”.

Others involved in the Tory government at the time also speak of how the emotional ties due to the closeness of Cameron’s family with Gove’s family had an effect on decision-making, coming to a bitter head when Gove, then education secretary, was demoted. Gove was moved in the reshuffle of summer 2014 to the post of chief whip. Cameron says Gove had wanted to become chief whip and speaks of his surprise when the other sent him an email in the midst of the reshuffle saying that he did not want that job.

David Laws, a Liberal Democrat minister in the coalition government, tells the programme that the consequences of the breakdown of the relationship between Cameron and Gove were enormous for the future of the country.

“Quite simply,” he says, “we might never have had that referendum vote to leave the European Union without Michael’s demotion in 2014.”

In a preview of the series this week, at the BBC, the executive producer Denys Blakeway said that during hours of interviews Cameron was asked if he felt any remorse over the EU referendum. The former prime minister chose deliberately, he said, to use the word “regret” instead.

Boris Johnson had agreed to be interviewed for the programme but cancelled on two occasions, according to Blakeway.