The Scottish Government today lost a UK Supreme Court appeal case over human rights which could undermine the convictions of criminals questioned without a lawyer.
A ruling issued today found that the practice was aimed at making it more likely a suspect in Scotland might "incriminate" themselves under police questioning.
"The ECHR (European Convention on Human Rights) requires that a person who has been detained by the police has the right to have access to a lawyer prior to being interviewed," the judgment states.
The defeat for Scottish ministers had been feared for months and has prompted concerns it could lead to widespread appeals and some criminals walking free from jail.
Today's ruling in the case of Peter Cadder - who was convicted at Glasgow Sheriff Court of two assaults and breach of the peace on interview evidence - is retrospective.
This had prompted fears it could lead to similar appeals in other cases where convictions have been secured under similar circumstances.
The judgment, though, found that cases which have already been dealt with by courts and not appealed within the usual deadlines must not now be reviewed as a "miscarriage of justice".
But it added: "The Scottish Criminal Cases Review Commission must make up its own mind, if it is asked to do so, as to whether it would be in the public interest for those cases to be referred to the High Court.
"It will be for the appeal court to decide what course it ought to take if a reference were to be made to it on those grounds by the Commission."
New interim guidance was issued to police north of the border earlier this year warning that suspects should now be given access to legal representation when they are interviewed and this will become permanent.
Previously suspects could be questioned for six hours without a lawyer present.
This is different a situation different from England and Wales, where an accused person has a legal right to a lawyer.
But a 2008 ruling by the Grand Chamber of the European Court of Human Rights found that the rights of Yusuf Salduz, arrested in Turkey in 2001, were infringed because he did not have access to legal representation when questioned by police.
Today's judgment added: "There is not the remotest chance that the European Court would hold that, because of the other protections that Scots law provides for accused persons, the Scottish system could omit the safeguard of allowing legal advice prior to interviewing."
Among the cases which may be affected by today's ruling is that of Luke Mitchell, who was just 14 when he was questioned without a lawyer by police investigating the murder of his girlfriend, Jodi Jones.
His case is already being investigated by the Criminal Cases Review Commission.
The Scottish Government said it will now introduce emergency legislation to Parliament today, which is expected to be passed tomorrow and receive Royal Assent by the end of the week.
Mr MacAskill added: "With Parliament's support, we will be making swift legislative changes to protect the victims of crime and safeguard communities.
"The main changes will mean introducing a right of access to legal advice before being questioned, extending the period during which a person may be detained under section 14 of the Criminal Procedure (Scotland) Act 1995, powers to adjust legal aid eligibility rules and measures to ensure certainty and finality in concluded cases.
"The decision overturns decades of criminal procedure in Scotland, a proud, distinctive, justice system, developed over centuries and predicated on fairness with many rigorous protections for accused persons.
"It is rightly admired by other jurisdictions. This issue is about legal advice at one step in the investigatory process.
"Today's judgment in the Supreme Court has gone against the unanimous decision last October by seven Scottish High Court judges at the Scottish Appeal Court that determined that an aspect of Scottish criminal procedure does not comply with the European Convention on Human Rights."
Mr MacAskill also announced that Lord Carloway, a senior High Court judge, will carry out a review of Scottish criminal law and practice in the aftermath of today's decision.Reuse content