Legislation which will allow mobile phone blocking technology to be used in prisons has been announced by Justice Secretary Kenny MacAskill.

Signal blocking equipment is to be piloted at two prisons by the end of the current financial year.

Mobile phones have been used in prisons for activities including organised crime, harassing victims and involvement in gang activity. Access to mobile phones has also been associated with drug supply, violence and bullying.

The number of mobiles found in prisons since 2011 reached a total of 1,988.

Legislation to be introduced by the Scottish Government will allow prison management to interfere with wireless telegraphy in order to prevent and investigate the use of illegal electronic communications devices by those in custody.

In December 2013, the Scottish Prison Service (SPS) awarded contracts for the installation of the state-of-the-art technology at two sites, HMPs Shotts and Glenochil.

Mr MacAskill said: "This Government made it a criminal offence for a prisoner to possess a mobile phone and the SPS has already invested considerably in the use of technology and intelligence capability to detect and prevent the use of mobile phones in our prisons.

"This new legislation will allow SPS to further extend their technology to disrupt the use of mobile phones by prisoners and is scheduled to be operational in a matter of weeks."

Colin McConnell, chief executive of the SPS, said: "Possessing or attempting to introduce a mobile phone into a Scottish prison is against the law.

"We will do everything we can to make the use of such devices impossible, and the introduction of this state-of-the-art technology is one of a range of measures we intend to take to detect, restrict and disrupt the use of mobile phones in our prisons. We will report any discoveries to the appropriate authorities."

The move was welcomed by the Conservatives.

The party's chief whip John Lamont said: "This is something we've been urging the Scottish Government to do for some time, so we're glad it's finally happening.

"When the technology exists to do things like this, it's crucial we use it.

"It's completely inexcusable for mobile phones to continue to find their way into prisons.

"So if that can't be stopped, this is the next best thing."