Jack Straw, the justice secretary, will introduce an emergency bill in the Commons next week to try to stop hundreds of serious criminal cases collapsing because of concerns about anonymous witnesses. Announcing the move yesterday, he said the bill was expected to go through all its Commons stages the week beginning July 7.

The Tories and Liberal Democrats are cooperating to speed the legislation through. They have agreed on the basis that the bill is a stopgap until more permanent legislation, already planned, can be introduced in the next session of parliament, and any long-term concerns can be raised then.

Parliament has been forced to legislate because of a House of Lords ruling last week that a double murderer, Iain Davis, was denied a fair trial when key witnesses who identified him as the gunman testified anonymously Straw said urgent action was vital to prevent a "significant" number of serious cases being put at risk.

The bill will also have to go through the House of Lords quickly if it is to become law before the summer recess on July 22. Lord Thomas of Gresford, the Lib Dem justice spokesman in the Lords, said peers from his party would not block it and he believed Tory and crossbench peers would take the same stance.

Yesterday the Crown Prosecution Service was urgently trying to work out how many cases were in the prosecution pipeline, but Straw said it was likely to be hundreds. In addition, police believe that up to 40 people already convicted at trials where anonymous witnesses gave evidence may seek to appeal.

The law lords said "special measures" used for the witnesses in the Davis trial were unlawful because there was no authority in English common law for their use and nothing in statute.

Ministers fear that those convicted may seize upon that technicality to try to have their convictions quashed. To try to avoid this, the bill will make use of a device known as "prospective overruling", a US legislative technique.

The second prong of the law lords' ruling in the Davis case rested on the right to a fair trial in article 6 of the European convention on human rights. The bill will have to comply with article 6, so will have to ensure that defendants still get a fair trial if anonymous witnesses are used.

If, for instance, their evidence is crucial to the case and they might have a motive for incriminating the defendant, as in the Davis case, witnesses may not be allowed to keep their identities secret, even after the emergency bill is passed.