When the British public voted for Brexit on 23 June, they might have brought down a Tory prime minister but it was the Labour party that found itself facing an existential crisis.

An attempted coup and a leadership challenge later, the party is on its way to confirming who is in charge, at least for now. But the challenge posed by Brexit will not go away. The general election of 2015 suggested a deep dislocation between the priorities of Labour and those of its traditional voters. Brexit laid it bare.

The Labour prime minister Harold Wilson would have something to say about it. He won four elections in the sixties and seventies, and played a key role in negotiating entry to the then-European Community, in the face of widespread left-wing Euroscepticism.

Wilson died in 1995. But his opinions live on in the memory of friends and colleagues. A century after his birth, the former shadow work and pensions secretary, Rachel Reeves, talked to one of Wilson’s former advisers, Bernard Donoughue at a Labour History Group event.

The picture that emerges is that of a social conservative who abhorred racism and promoted women; a provincial who, despite his own instincts, fought to get Britain into Europe.

Wilson came from Huddersfield, a market town wedged between Manchester and Leeds, where nearly 55 per cent voted Leave in the EU referendum. According to Donoughue, Wilson himself “wasn’t instinctively European”. But in the late sixties, he continued, Britain was the sick man of Europe:

“It was quite interesting that he led a bid to go in and that shows Harold the realist seeing that we needed to do something and quite radical.”

Wilson found himself presiding over the first referendum on Europe in 1975. His Tory predecessor, Ted Heath, had officially already taken the UK in two years earlier, but Labour promised a referendum in its election manifesto.

Now, Wilson had to convince the nation, and those in his own party suspicious of a free trade union, that Europe was the right choice.

Donoughue described his tactics:

"Harold was prime ministerial, made clear that as Prime Minister he was in favour of coming in and he also made clear he understood why they had reservations. But, he said, 'I've thought about it and with reservations I'm for going in' so they were willing to go with him and that was very important.

As with today’s embattled Labour leader, Jeremy Corbyn, some wondered what Wilson had himself voted, but he confirmed to Donoughue he had chosen In. Donoughue asked why, and Wilson's answer showed a foresight lacking in many pundits today:

“I expected a sort of lecture on the benefits of the free trade and all this statistical stuff. And [instead] he said: ‘Oh, it's quite simple, pulling out would put the wrong people in power.’”

If the ghost of Wilson was campaigning in the heady days of June 2016, though, would his tactics have still worked? Donoughue believes so:

"It would have been the same way. He would have shown that he shared their reservations and would explain why it was good for working people to be in: not why it was good for him, for the city, for the establishment and all of that stuff but for working people and for trade unions."

Crucially, though, according to his former adviser, Wilson would have started his campaign a long time before the vote: “It wouldn't be him speaking after year’s silence. That would be part of a continuing conversation.” In the event, two-thirds of voters opted for Europe.

Wilson’s achievement – in the eyes of Remain voters, at least - is now unravelling. But he set the course of modern Britain in more ways than one. He oversaw reforms on abortion, divorce and the rights of gay men. He abandoned his fondness for wartime-style planning in favour of a technological revolution. Through it all, he maintained a concern for the views of working people and, in Donoughue's words, a "concern for the underdog".

Then there are the achievements that would pass almost unnoticed if not for the tempestuous state of politics in post-Brexit Britain. Labour would see a split in the 1980s, when four party veterans set up the Social Democratic Party.

But in the two previous decades, Wilson kept the Labour party together. As Donoughue put it:

"Politically, his priority was to keep the party united, to seek common ground with people, to seek the common good of the nation. He always derided dogma, what he called theology, of either the left or the right. He was certainly never a Marxist socialist but he always had good relationships with the soft left, not the hard left, he knew their number. But he always had good relations with the soft left and then governed from the centre right. Which seemed to me a very sensible way of doing things."

Rachel Reeves' book, Alice Bacon: Picking your Battles, about a prominent female minister in Wilson's government, will be out in November.

Bernard Donoughue's book, Downing Street Diary: With Harold Wilson in No. 10, is available in paperback and hardback.