MEXICO CITY — Guatemala’s highest court on Monday threw out the genocide conviction and prison sentence of the former dictator Gen. Efraín Ríos Montt.

The decision by Guatemala’s Constitutional Court was a dramatic legal victory for General Ríos Montt, 86, and a blow to human rights advocates who had called his conviction a sign that Guatemala’s courts would no longer allow impunity for the country’s powerful.

General Ríos Montt was sent to prison immediately after the verdict on May 10 when a three-panel tribunal found him guilty of genocide and crimes against humanity. He was sentenced to 80 years in prison but was soon transferred to a military hospital for medical tests. Monday’s decision means that he will return to house arrest, where he had been held since the case against him began in January 2012.

The additional effects of Monday’s court ruling were unclear. The court did not invalidate the entire trial, which began on March 19. Instead, the court ordered that the proceedings be rolled back and reset to April 19, when a complex decision by another judge sent the trial into disarray, causing a brief suspension.