Jack Straw said the laws of evidence have to reflect 'real life' witness fears
The government has vowed to change the law to allow anonymous witnesses in some court cases after a key Law Lords ruling effectively halted the practice.
Justice Secretary Jack Straw said there was a real need for some witnesses to have their identities protected.
Mr Straw told BBC Radio 4's Today programme that the law will be changed "as quickly as possible".
The ruling quashed the murder conviction of a man who was convicted with the aid of anonymous evidence.
Police have warned that serious criminals could walk free as a result.
"I am looking at this very urgently indeed," Mr Straw said of the ruling, which applies to criminal cases in England, Wales and Northern Ireland.
He said the reality of violence and intimidation in some criminal circles means accommodations must be made within the rules of evidence.
Mr Straw signalled that planned government legislation to enshrine the use of anonymous witnesses where intimidation is a risk would now become a priority.
"Ever since this judgment on Wednesday this has been my major preoccupation, to ensure that we are able to change the law as quickly as possible."
He said that while the right to a fair and open trial is essential, there were limits.
"It is fundamental that defendants should be able literally to see and hear the evidence before them," he said.
"But you have to balance that against what actually happens in real life these days where you've got very serious gun and drug crime and there is such a high level of fear."
Senior Metropolitan Police officer John Yates told the Daily Telegraph that the ruling means convicted criminals could appeal and be freed if witnesses refused to reveal their identities in a retrial.
Police in London believe up to 40 criminals could now launch appeals, the Telegraph reports.
Mr Yates, who is assistant commissioner of the Met, made his comments after Iain Davis's double murder conviction was quashed by the Law Lords.
He said: "A lot of good work is being undone, and this will play out so badly in terms of those we are trying to reach out to in communities. It almost feels like we have broken our word.
"To see clearly guilty people walking free is just awful."
Sally O'Neill, chairman of the Criminal Bar Association, said the Law Lords were sending a clear message about the need for fair trials.
"This is a very difficult problem and I think what the Law Lords are saying is that you shouldn't just chip away at a defendant's rights in order to have a trial at all costs."
But Mr Yates said anonymous witnesses were not a common tool in the courts.
"Special measures are only used in the most extreme cases, which means these are our most dangerous criminals, people who have been jailed for up to 40 years. And they could be walking free."
Davis was convicted of killing of two men in a shooting at a flat in Hackney, east London, on New Year's Day 2002.
At the trial in 2004, seven witnesses claimed to be in fear for their lives if it became known that they had given evidence against Davis.
In order to persuade them to give evidence against the accused, trial judge David Paget QC allowed witnesses anonymity.
Without the evidence of three of the witnesses, Davis would not have been convicted, said Lord Bingham, the head of the panel of judges who sit at the country's highest court, at the House of Lords.
But he ruled: "I feel bound to conclude that the protective measures imposed by the court in this case hampered the conduct of the defence in a manner and to an extent which was unlawful and rendered the trial unfair."
He, along with four other Law Lords, allowed Davis' appeal and sent the case back to the Court of Appeal, which was asked to quash the conviction.
It was also asked to decide whether to order a retrial if an application was made by the prosecution.
Shadow justice secretary Nick Herbert, said: "We share police concern about the ruling of the Law Lords in the Davis case. The public must be protected from the most violent criminals.
"We are already discussing these issues constructively with the government to consider what legislation may be necessary."