It was described as "Scotland's shame" and its role in detaining children of failed asylum seekers brought widespread condemnation - but if the pilot scheme announced today succeeds, Dungavel's notoriety will be consigned to the history books.

The South Lanarkshire detention centre was controversial from its opening in 2001, but it was the plight of the Ay family, first raised by The Herald, that highlighted the personal suffering of families caught in the system.

Like most of those detained at Dungavel, the Ay family were detained there while awaiting a decision over their appeal against deportation.

They lost their appeal. Yurdigal Ay and her four children, aged eight to 14, were deported to Germany in August 2003 after spending more than a year at the centre.

During the Turkish Kurd family's stay in Scotland, church and union leaders, cross-party politicians and children's charities condemned their incarceration, arguing it breached international children's rights laws.

The support for the Ay family was so strong the Home Office changed the time-limit detainees could be held at Dungavel to 72 hours before being transferred to England.

They were later granted asylum in Germany after a court received psychiatric reports into the emotional health of two of Mrs Ay's daughters as a result of their incarceration in the centre. Dungavel became the focus of debate soon after it was announced that it was to be one of 10 immigration detention centres in the UK, and the only one in Scotland, set up to deal with Britain's asylum crisis.

The former open prison, near Strathaven, which had the capacity to hold almost 150 people and included a 56-bed family unit, became known as the enforced home of the children of failed asylum seekers.

The baronial pile, built as a summer retreat for the Dukes of Hamilton, became the scene of many protests by campaigners angry at the government's detention of asylum seekers and their families.

In January 2004, Scottish Catholic Bishop John Mone said that holding children in prison-like conditions such as Dungavel "shamed the people of this country".

The Bishop of Paisley, also president of the Catholic Church's justice and peace commission, called on then Home Secretary David Blunkett to find more humane ways of dealing with families.

The Home Office said families must be kept in secure accommodation to stop them absconding before their cases were heard. Mr Blunkett visited Dungavel six months later and described conditions there as "entirely satisfactory".

However, in September 2004, Professor Kathleen Marshall, Scotland's Commissioner for Children, asked the Home Office to explain its policies on holding young people at Dungavel.

The following May, a report by HM Chief Inspector of Prisons Anne Owers described provision for children at Dungavel as "inadequate" and criticised the failure to implement recommendations made during a visit two years earlier. She said she was "extremely concerned" about children at Dungavel where there were no "proper independent procedures in place so that the welfare needs of those children could be properly identified and met".

Last October, the Scottish Government called on Westminster to end the detention of the children of asylum seekers at Dungavel.

The SNP administration is opposed to family detention but responsibility for immigration lies with the government at Westminster.

The month before, The Herald revealed the children of failed asylum seekers were being held at Dungavel alongside hardened criminals, including men convicted of anything from human trafficking to rape.

Last year, Ms Owers said the Dungavel immigration removal facility was now the best of its kind in Britain. She praised the unit, run by the Border and Immigration Agency, for advances, including in welfare, religious affairs and education.

However, children are still detained at the centre. The Scottish Refugee Council, campaigning to stop the detention of families, says the new 72-hour time limit is inhumane. The number of children presently detained is not disclosed by authorities.