David Cameron made a late appeal to Germany's Angela Merkel for limits on free movement of people if the UK voted Remain, BBC Newsnight has learned.
The then-prime minister called the German leader days before the EU referendum, as opinion polls seemed to show voters moving to the Leave camp.
But he later abandoned the idea of getting her and other EU leaders to make a statement granting concessions.
No 10 decided it could be portrayed by Vote Leave as a sign of weakness.
Newsnight has learned that Mr Cameron telephoned the German chancellor to ask whether she would be willing to issue a statement with fellow EU leaders granting the UK concessions on free movement.
Under the plan, thrashed out at a meeting in Downing Street, the president of France Francois Hollande, the European Council president Donald Tusk and the European Commission president Jean-Claude Juncker would all put their names to the joint statement by EU leaders.
The former prime minister approached his German counterpart after Vote Leave had dominated the campaign in the wake of the publication of official migration statistics at the end of May. These showed the government had once again failed to meet its net migration target.
The idea of a joint statement by EU leaders was eventually shelved.
Newsnight understands that at an EU summit after the EU referendum the German chancellor made it clear to Mr Cameron that there could be no compromise for EU members on rules governing the free movement of people.
The appeal by Mr Cameron to Mrs Merkel followed a discussion among senior Downing Street aides who said that the prime minister should reprise the success of "the Vow" in the Scottish independence referendum.
Mr Cameron and the other main Westminster parties had moved to shore up the pro-UK vote in the final stages of that campaign in 2014 by pledging to devolve further powers to the Scottish parliament.
The move considered by the prime minister, revealed by Newsnight in an investigation into the EU referendum campaign, shows that Downing Street came close to ripping up a key element of its strategy in the final stages.
This was to focus on the economic risks of Brexit and to avoid discussing immigration on the grounds that Vote Leave would always say that the UK could never control its borders while it remained a member of the EU.
In the end Downing Street maintained the focus of its campaign on the economy. Lord Cooper of Windrush, the Conservative peer who was the main pollster for the Britain Stronger in Europe campaign, told Newsnight that the pro-EU side's failure to address concerns about immigration had been a weakness.
He said: "The people who are very, very concerned about immigration, what they wanted was purely and simply for the UK to be able to have total control of its borders and total control of the flow of people into this country. And we didn't have an argument that could remotely compete with that.
"It meant we couldn't really engage in the campaign on that vital issue. We didn't have much option but to keep trying to pivot back to the economic risks."
One Downing Street source told Newsnight: "Fundamentally a question was put to the British public - would you be willing to be a little bit poorer to get control of immigration? We staked our chips on everyone going, 'Well, I don't want to be poorer.' They staked their chips on everyone going, 'I want to control immigration,' and they won."
Lord Cooper also told Newsnight that the pro-EU side was forced into "humanely" phasing out a claim by George Osborne that a British exit from the EU would cost the average household £4,300 because voters did not believe it.
Lord Cooper said: "The problem with that figure - the £4,300 - was firstly it sounded implausibly large to the ears of most people. Secondly it sounded strangely specific…The figure was sort of humanely phased out because we found when we tested the reaction in focus groups, we found people just rejected it. They didn't believe it."
Matthew Elliott, the chief executive of Vote Leave, said he feared that the death of the Labour MP Jo Cox a week before polling day could have ended his campaign, when news broke shortly after the UKIP leader Nigel Farage had launched a controversial poster on immigration.
But Mr Elliott said that the UKIP poster had little impact on the Vote Leave campaign because he had distanced the official Leave campaign from UKIP.
Nicholas Watt was reporting for Brexit Britain - a BBC Newsnight special one month on from the referendum result.
The hashtag for the event is #BrexitBritain.