It would be "very, very difficult if not impossible" to have separate Brexit arrangements for different parts of the UK, Jeremy Corbyn has said.

The UK Labour leader said it would be very complicated to separate things out because some companies operate across the whole of the country, and that a UK-wide agreement is needed.

He also said that the idea of separate economic and legal systems in different parts of the UK becomes "difficult and very problematic".

Mr Corbyn was speaking at the New Town Theatre in Edinburgh on Sunday in conversation with comedian and broadcaster Susan Morrison, on the last day of his five-day tour of Scotland.

The UK leader spoke after Labour said it is committing itself to continued UK membership of the EU single market and customs union during a transition period following the official Brexit date of March 2019.

In a dramatic policy shift, the party's shadow Brexit secretary Sir Keir Starmer has announced that a Labour government would abide by ''the same basic terms'' of Britain's current EU membership during the transition, which some observers expect to last as long as four or five years.

Mr Corbyn said: "There has to be an arrangement in the long term with Europe which is one of tariff-free trade access to Europe that gives protection of the rights, regulations and gains we've made from Europe on workers' rights as well as protection of consumer rights and continued membership of the European institutions, particularly the European Court of Human Rights, but there are many others as well.

"Could you have a separate arrangement for different parts of the UK?

"I think that becomes very complicated because if you are trading, companies exist in Scotland, exist in Wales, exist in England, they are making things, doing things together, it would be very, very difficult if not impossible to see how we could separate those out.

"It has to be a UK-wide agreement."

In the question and answer session with members of the audience Mr Corbyn was asked whether the party would consider fine tuning its policies further in a federalist way to reflect the nations that voted remain in the EU referendum.

He replied: "We are thinking very hard about what forms devolution would take in the future. Devolution in Scotland has gone a long way.

"We are looking at the way we bring about genuine devolution and particularly economic devolution. Could you have a separate economic and legal system in different parts of the UK?

"I think that becomes difficult and very problematic. I want a Labour government that is going to legislate better working conditions for everybody across the UK."

Mr Corbyn has been targeting marginal seats held by the SNP on his tour of Scotland.

During the talk at the festival he spoke about his school days, remembering how his school was divided between the better-off children who went out shooting birds at the weekends and those who did the beating of the birds, while he did neither.

He also spoke about his time teaching in Jamaica as a young man and travelling around South America.