A Guatemalan judge ruled Thursday that all the testimony in the genocide trial of the former dictator Efraín Ríos Montt, 86, was invalid and would have to be repeated. The decision, based on a technicality, was a victory for Mr. Ríos Montt’s lawyers, who had filed a barrage of injunctions seeking to stop or postpone the trial. Over the past month, the court has heard testimony from dozens of people who survived army-led rampages through villages in the Mayan highlands three decades ago during the country’s long civil war. Mr. Ríos Montt’s lawyers argue that their client did not know about the atrocities being committed by his troops. Prosecution witnesses this week described a rigid military chain of command leading directly to Mr. Ríos Montt.