Emergency legislation was proposed following a Law Lords' ruling
Emergency legislation to allow witnesses in sensitive criminal trials to give evidence anonymously has cleared Parliament.
The measure was rushed through both houses in "double quick time" before the summer recess begins next week.
It is intended as a stop-gap, after a Law Lords ruling last month questioned the use of anonymous witnesses.
The ruling led to the collapse of a £6m murder trial at the Old Bailey, which is to be retried next year.
The Criminal Evidence (Witness Anonymity) Bill completed its passage through both Houses of Parliament after MPs agreed with amendments made in the Lords, and will now go for Royal Assent.
Justice Secretary Jack Straw thanked politicians from all parties and officials for securing its speedy progress.
He told MPs: "It was important that we got this bill through as quickly as possible.
"It is the duty of the opposition to oppose, but they have done so in a very productive way, recognising the imperative of getting this through."
In their ruling in June, the Law Lords argued it was a fundamental principle of English law that the accused should be able to see his accusers and challenge them.
The Crown Prosecution Service has identified about 580 current cases involving anonymous evidence - in many cases to prevent intimidation of witnesses - which could be threatened by this.
The Criminal Evidence Bill is set to be replaced by a new Law Reform, Witnesses and Victims Bill in the next parliamentary session.
Critics of the emergency legislation say it could lead to more widespread use of anonymous witnesses. Its measures apply to both defence and prosecution witnesses.