The former Labour First Minister Henry McLeish has said if Labour the party had campaigned harder in the EU referendum, Brexit would not be happening.

The former Scottish Labour leader also said he could back Scottish independence if the UK leaves the EU, although he believes that Labour and allies in other parties could scupper the process at Westminster.

In his appearance at the Edinburgh International Book Festival, where he talked about his new book, Citizens United, McLeish said: "I passionately believe two things: that we should remain in the EU, and I would urge all at Westminster to use the natural majority to derail and ultimately defeat Brexit.

"I would also say to Labour's leader at this point, if Labour had had half a campaign running for the referendum, Brexit would not have won.

"The second point is an invitation to Jeremy [Corbyn, Labour leader] and John McDonnell [Shadow Chancellor] to put their own ideas of the EU behind them, and use the House of Commons, or another referendum, to make sure that there is a proper debate on this empty box that we voted on.

"There are so many pressing needs that Labour should address, and I believe the leadership of Labour should be foursquare behind remaining in the EU."

McLeish laid out his desire for a written constitution for the UK, and a federalist state which would give power "in a real sense" to the Scottish Parliament.

He said federalism would be a different way to change the constitution of the UK between "devol-unionism" and Scottish independence.

He admitted federalism was hardly "on the radar screens" at Westminster.

McLeish said the SNP had showed "charismatic leadership" and "competence" in the last ten years in Scotland.

McLeish said: "I believe there is another way and it is called federalism, but maybe it is too late, maybe the die is cast.

"Maybe a Hard Brexit will push more Scots into supporting independence, with the absence of any alternatives."

Questioned by chair Ruth Wishart, McLeish added: "I am nearly there, because I am passionate European: I teach in Europe and the US.

"I am a patriot of Scotland, although not a nationalist in that sense, and I do believe there are choices to be made for Scotland.

"I would say if we do come out of the EU - and I am really optimistic that we can destroy this madcap idea - if we can't, and we come out under the Hard Brexit, then it may well be that I am at the end of prevaricating over this question.

"I would not want to be part of Britain that is not part of the European Union."

A member of the audience suggested in a question that he was a "mole for independence" and had laid out a "perfect case" for independence.

McLeish responded: "If you come out of Europe, it changes the dynamic, changes the context.

"I have had to come clean and say: I am nearly there."

Last night the book festival also saw a novel exploring a relationship between two actors and a biography that opens a window on the world of fine art have win Britain’s oldest literary awards.

Eimear McBride and Laura Cumming join the distinguished list of writers who have won the James Tait Black Prizes, awarded annually by the University of Edinburgh.

The winners of the £10,000 prizes were announced by broadcaster Sally Magnusson at the Edinburgh International Book Festival.

Eimear McBride’s winning book, The Lesser Bohemians, in the fiction prize traces a love affair between an 18-year-old drama student and an older actor and is set in mid-nineties-London. The Lesser Bohemians (Faber and Faber) is her second novel.

Laura Cumming’s winning entry in the biography prize focuses on the great Spanish court painter Diego Velázquez and a Victorian bookseller, John Snare, who thought he had found a lost painting of the celebrated artist.

The Vanishing Man: In Pursuit of Velazquez (Chatto and Windus) is Laura Cumming’s first biography.