Nicola Sturgeon has said the Edinburgh International Book Festival is being "undermined" by immigration policy, after visas were refused for several visiting authors.

The festival's director, Nick Barley, said many had faced a "humiliating" process to come to the UK.

Due to start at the weekend, the festival in Charlotte Square features around 1000 authors from across the world at 900 events.

Mr Barley said visitors from the Middle East, North Africa and elsewhere faced difficulties in coming to the UK, and feared artists would be reluctant to come to UK festivals in future.

The First Minister tweeted a response to an article on the issue, saying ministers had to "get it sorted."

She said: "It is really not acceptable that one of the world's most renowned and respected book festivals is being undermined in this way.

"The UK government needs to get it sorted."

Mr Barley told STV News: "The problem we're having with visas is the huge amount of time it's taking to get clearance.

"Some people are having their visas rejected and they're having to reapply two or three times.

"Others are simply facing the humiliation of a process which can last up to five months.

"For many authors who have applied to come to an international literary festival in Edinburgh, they have no idea that they will have this humiliating process to go through simply to come and talk about their ideas."

He said the number of issues with visas had increased over the last two years.

Authors had faced biometric tests along with being asked to show three years of bank statements and family birth certificates, he said.

The Home Office has a list of 45 festivals which are able to invite entertainers from abroad, avoiding certain immigration restrictions.

However the book festival is not among the 45.

A Home Office spokesman said: "We welcome artists and musicians coming to the UK from non-EEA countries to perform.

"In the year ending December 2017, 99% of non-settlement visa applications were processed within 15 days and the average processing time in 2017 was just under eight days.

"Guidance on visa and entry clearance requirements is publicly available on gov.uk.

"Each case is assessed on its individual merits against the published Immigration Rules."