CAIRO — Testimony on Thursday in the criminal case against former President Hosni Mubarak implicated top officials for the first time in ordering the use of force against demonstrators. The evidence added to a patchwork of contradictory accounts that have cast a shadow over the first days of the proceedings.

The testimony was the first clear step forward for the prosecution, which was left reeling after its first five witnesses — all police officials — recanted what prosecutors said were their initial statements about instructions from senior police officials to use live ammunition or other force against the protesters. The prosecutors apparently intended to build their case from the bottom up, starting with the orders issued to police officers confronting the demonstrators.

But those efforts have now been all but cast aside, first by the unexpected police testimony and then by the judge’s decision to order the country’s top two military officials to testify. On Wednesday, the judge called on Field Marshal Mohamed Hussein Tantawi and Gen. Sami Enan to give testimony in a closed proceeding beginning Sunday. The two men were members of Mr. Mubarak’s inner circle before seizing power in the name of the revolution.

Thursday’s testimony did not recount explicit discussions about using live ammunition or any direct actions by Mr. Mubarak. However, the testimony did feature a highly placed former police officer saying publicly for the first time that in the early days of the revolt, Mr. Mubarak’s interior minister, Habib el-Adly, instructed his aides to use all necessary means to stop protesters from reaching Tahrir Square in the center of Cairo. Mr. Adly is also a defendant in the trial.