Dungavel detention centre is to remain open after plans to build a replacement unit near Glasgow Airport were rejected.

The Home Office announced last year that the controversial centre near Strathaven, South Lanarkshire, was to close at the end of 2017 and a short-term holding centre built in Paisley.

However, Renfrewshire Council has rejected the application, meaning Dungavel will remain open.

Campaigners had welcomed the planned closure of the detention centre but raised worries about its replacement.

Dungavel has been branded ''racist and inhumane'' and it has been at the centre of numerous protests in recent years over the treatment of detainees and the length of some detentions.

A Home Office spokesman said: "We always made clear that the closure of Dungavel immigration removal centre was dependent on the opening of a new short-term holding facility in Scotland.

"As the application for a new facility at Paisley was rejected, Dungavel will remain open."

Dungavel has long been a political issue, with MSPs demanding an end to the detention of children at the centre, leading to a 2010 Westminster ruling that families detained north of the border would be moved to Yarl's Wood in Bedfordshire to give them access to specialist family, child and support services.

Detainees have also taken part in action inside Dungavel, with many refusing food in a protest against a suicide at the centre in 2007.

The Home Office had said Dungavel, which holds up to 249 detainees and is the only such centre in Scotland, is ''under-utilised due to its remote location''.

Plans for the centre beside Glasgow Airport would have had just 51 beds and the Home Office said the ''vast majority'' of stays would have been for less than a week.

Jerome Phelps, director of Detention Action, said: "It is disappointing that the Home Office has heard the opposition even to short-term detention in Scotland, and decided instead to persist with long-term detention.

"This means that migrants will continue to be detained indefinitely without time limit in Scotland, and the Government is no nearer to fulfilling its promise to reduce the lengths of time that migrants are detained."

However, the move was welcomed by John Park, assistant general secretary for the union Community.

He said: "The fact the Government will not be contesting the planning decision is testament to the campaigning efforts of our members and the quality of the public service that they deliver in providing a safe environment for detainees.

"We hope this will now bring an end to the uncertainty that has been hanging over our members for many months.

"There is still some work to do to confirm how long the Dungavel contract will be extended. We will continue to work with our members, the employer and politicians from all sides to provide certainty and job security for our members."

Meanwhile in the latest high-profile case at Dungavel, it has been reported that a woman who has been married to a British man for 27 years is being held prior to deportation.

BBC Scotland said Irene Clennel, from Durham, was given indefinite leave to remain in the UK after her marriage but periods spent back in Singapore caring for her elderly parents appear to have invalidated her residential status.

She told the BBC: "The kids are born here. My husband is from the country. So I don't see what is the issue. But they keep rejecting all the applications."

Green West of Scotland MSP Ross Greer campaigned against the building of a new centre.

"I'm glad to have stood with campaigners against detention centres, new or old," he said.

"Regardless of this decision though, refugees and immigrants were always going to be the losers while immigration policy is decided at Westminster."

Pauline Diamond Salim from the Scottish Refugee Council said: "This issue was never just about the location of the detention centre. It doesn't matter whether it's in Renfrewshire or South Lanarkshire, the current system of detention for immigration purposes in the UK is not fit for purpose.

"The way the Home Office has handled this 'planned' closure of Dungavel shows a worrying lack of strategic thinking around this whole issue.

"We are very disappointed that long-term indefinite detention will continue in Scotland and we'll continue to campaign with many others for an end to this inhumane and inefficient practice."