Leaving the European Union (EU) will be a "gargantuan exercise" which will tie the civil service in knots for years and have "absolutely horrendous" implications for day-to-day governance, a legal expert has warned.

Holyrood's European and External Relations Committee was told that a vote to quit the EU in David Cameron's planned referendum in 2017 will likely require a withdrawal agreement to be reached between the UK and the remaining member states.

The move would be a "very long and painful" process, and would be followed by the "de-EUifing" of swathes of British legislation, the committee was told.

It heard from a range of experts in EU law as it continues to gather evidence on the implications of EU reform and the in-out referendum on the UK's membership.

The experts rejected the view the UK could exit the EU by repealing the 1972 European Communities Act, the legislation which provides for the incorporation of EU law in the UK, stating this alone would not effect withdrawal and would leave the UK exposed to a host of international legal actions.

The Herald:

Professor Catherine Barnard, Professor of European Union Law at the University of Cambridge, said: "It will be a gargantuan exercise.

"It will tie the civil service, both Whitehall and the devolved administrations, up in knots for years to come.

"It will paralyse the operation of day-to-day government because so much time will be devoted to unpicking these very complicated issues.

"The implications just for government and day-to day governance are absolutely horrendous."

Repealing the 1972 European Communities Act would be "a drop in the ocean compared to the logistics that will follow on from that", she said.

Professor Adam Lazowski, of the University of Westminster, told the committee that Article 50 of the Treaty on European Union gives provision for a member state to leave.

The UK and remaining member states would likely negotiate terms of withdrawal and provisions for a future relationship.

He said that such a task could take years, describing it as "a very long and painful process".

Professor Sir David Edward, a former Judge of the European Court of Justice, said that with "goodwill" the process could be concluded within the two-year time frame for withdrawal set out in Article 50.

"I suppose with goodwill it could be concluded, but you have got to assume that the other member states would be prepared to go some way to accommodating a future British relationship, which I suspect they might not," he said.

"If we say, 'right, we want to withdraw' ... then I am not by any means certain that the others would be enthusiastic about making generous concessions to the UK. You could have a deadlock."

Dr Cormac Mac Amhlaigh, of the University of Edinburgh, warned of "lots of legislative change in UK in terms of "de-EUifying" British law, which is embedded in many, many statutory provisions".

"Then we would need a new relation with the EU act stipulating the details of what the future relationship would be."