The potential impact of Brexit on higher education "ranges from bad, to awful, to catastrophic", the principal of Edinburgh University has warned.

Professor Sir Timothy O'Shea told MPs that while the outcome of leaving the European Union is as yet unknown, "however you parameterize it, things get worse".

The University of Edinburgh is ranked in the top 20 higher education institutions across the world, with the principal and vice-chancellor stressing the importance of overseas staff and students to the academic sector.

He urged Prime Minister Theresa May to consider striking a "special deal", warning that any future restrictions on the free movement of Europeans would have a damaging impact on the sector.

Sir Timothy said current Home Office visa restrictions had damaged universities "a bit", but added: "If Brexit isn't appropriately negotiated they could be damaged in a very serious way.

"Yesterday the Prime Minister said helpfully that perhaps a special relationship might be necessary for workers in the City, for the car industry. But God help me if the City and the car industry deserve a special deal, then the universities... they are more dependent on the mobility of highly skilled labour than any other sector."

He was speaking as MPs on the Scottish Affairs Committee took evidence on the impact of Brexit from a number of key industries north of the border.

Sir Timothy told them a third of Edinburgh University's research output is carried out in collaboration with academics from other EU countries, while a quarter of research staff are from other parts of the EU, totalling almost 5,000 workers.

He said many of these workers "have now been in Scotland for 20 or 30 years and are desperately worried about their future, and about 10% of our research funding".

With 42% of Edinburgh students coming from outside of the UK, he said the "anxiety and distress for the future is palpable".

He told the committee: "The big research problems, whether it is the environment, or dementia, or the hunt for the Higgs boson, these are not done at the level of Scotland, or the UK, or for that matter Europe, these are deeply international.

"And there need to be mechanisms for a bespoke relationship between either the UK or Scotland and the EU, that is absolutely vital."

With an exit deal not yet negotiated between the UK and the remainder of the EU, and with a lack of detail about what any future arrangements could look like, Sir Timothy said "we don't know where we're going to get to".

But he stated: "What one can say with confidence is however you parameterize it, things get worse. So the issue is not do they get worse, the question is how much worse, how much less access to EU funding, how much less support.

"There is a large amount of uncertainty and when you run different models it ranges from bad, to awful, to catastrophic."

Christopher Chope, the Conservative MP for Christchurch, told the university principal: "It seems to me from your evidence so far you are having real difficulty coming to terms with the outcome of the referendum."

Sir Timothy responded: "It would be deceitful of me to pretend that Brexit is not a problem, the issue is what the shape and size of the problem is has not been properly defined for us yet."

Norman Provan, associate director for the Royal College of Nursing Scotland, also raised concerns about the impact Brexit could have on the health service workforce.

He told the committee there were some 33,000 registered nurses from Europe working in the UK, and said: "If we didn't have access to those nationals, if those nationals couldn't stay within the UK, that would create a significant difficulty in a workforce that already is pushed, vacancy rates for the NHS in Scotland are going up."

Stephen Boyd, assistant secretary of the Scottish Trades Union Congress, told the MPs: "We're often asked at the moment to comment on opportunities that we perceive from Brexit, I find this particularly difficult.

"We struggle very much to discern hard, realisable opportunities."

However, Bertie Armstrong of the Scottish Fishermen's Federation said leaving the EU is "potentially a big opportunity" for the UK's fishing industry.

He said: "Since the vote, which frankly was as big a surprise to us as the rest of the nation, it suddenly opened a door for us.

"What we have seen since that day is a growing consensus, a growing understanding by government and the general public that this is potentially a big opportunity for the fishing industry of the UK."

He said that at present, "quite a lot of the fleet works at quarter-throttle", adding: "We've had to do that for sustainability, the fleet is much smaller but none of it is fully occupied because of the way the CFP (Common Fisheries Policy) works.

"If we had much greater opportunity, the catching could be enhanced."

Mr Chope told the fisheries leader: "Your clear and positive vision is going to be music to the ears to many people who have been campaigning for a long time to leave the European Union."

Mr Armstrong went on to warn politicians and others against having an "over focus on the challenge" caused by Brexit without looking at the positives.

He said: "We are concerned about the general atmosphere of concentrating so hard on the challenges and the changes that Brexit will bring, that you end up under the table in the foetus position with your thumb in your mouth, hoping that somehow it will all go away.

"We don't want the strength of negotiation of both the Scottish Government and the UK Government acting together to be in any way damaged by an over-focus on the challenge."

Mr Armstrong added: "What we could be is a world leader in sustainable seas, that catch is so big, so much comes out of it, that is the sea of opportunity grand prize."