More than a decade ago, amid a low-tech war against leftist militants, then-President Alberto Fujimori gave his prosecutors and judges a series of legal super-weapons to fight an enemy that seemed poised to engulf this country in violence and fear.
Hooded military judges could impose life sentences on defendants for treason, based on secret evidence given in secret tribunals that were denounced by many human rights activists as kangaroo courts.
Now, with the enemy long defeated, top jurists and legislators are moving to restore a sense of integrity to Peru's legal system. Early this month, the nation's highest court ruled that several 1992 decrees issued by Fujimori were unconstitutional.
On Saturday, President Alejandro Toledo presented the first in a series of revised laws that will bring the 1990s legal war against Shining Path, or Sendero Luminoso, and other extreme-left groups in accordance with international standards of human rights -- without freeing the most violent militants.
"Drastic laws were needed -- it was not a normal situation, it was almost a civil war," said Hubert Lanssiers, a prison chaplain who headed an "innocence commission" that was created in 1996 and that released about 900 people wrongly convicted under the anti-terrorism measures.
"But the laws were ferocious, and terrorism was not clearly defined," he added. "If I got out a red cloth to wipe my car, I could be accused of advocating terrorism. It was not reasonable."
Decree 25880, for example, made it "treason to the fatherland" for a teacher or professor to speak in favor or defense of terrorism. The sentence for violating the decree: life in prison. That decree was one of four overturned by Peru's Constitutional Tribunal.
Also overturned were decrees that allowed terrorism suspects to receive summary trials in military courts -- an action similar in spirit to the Bush administration's announcement in 2001 that it would allow special military courts to try suspected terrorists.
"We acted in accordance with the Constitution and the international treaties ratified by Peru," said high court Judge Delia Revoredo, explaining the court's decision. "That's how democracy is. You respect the human rights of everyone, even terrorists."
In all, about 30,000 people were killed in the tragic cycle of violence that began when guerrillas ransacked a provincial polling station in 1980. The group, eventually known as the Shining Path, became arguably the most ruthless guerrilla movement in South American history.
The war against Shining Path also consumed many democratic institutions. In April 1992, at the height of the conflict, Fujimori staged what came to be known as a "self-coup." He shut down Congress and the courts, and ordered the arrest of nonviolent government opponents.
Fujimori issued the first of his anti-terrorism decrees a few weeks later. The crackdown produced quick results: Abimael Guzman, the provincial professor who formed Shining Path, was captured that September.
When the Interamerican Court of Human Rights declared in 1999 that Peru's anti-terrorism courts did not "satisfy the minimum requirements for due process," Fujimori's government stopped recognizing the international court's jurisdiction.
Peru's decision to renew ties to the court in the wake of Fujimori's ouster in 2000 established the legal framework for this month's decision by the Constitutional Tribunal. Javier Alva Orlandini, president of the tribunal, said the high court also acted in response to a petition from more than 5,000 citizens.
The members of a truth commission, a separate panel set up after Fujimori's ouster to investigate two decades of political violence, hailed the ruling as a step forward in the return to democracy.
"This is not a victory for those who promoted armed violence and terror as a means to conduct politics in Peru," the commission said in a statement.
The leaders of most political parties have agreed to work together to revise the laws, hoping to complete the process by early next month.
"We'd have to be suicidal or just plain imbeciles not to understand that this is a problem that requires absolute national unity," said former President Alan Garcia, a leader of the opposition Aprista Party.
Peru's Congress agreed to give Toledo and his Cabinet special powers to bring the anti-terrorism laws in line with the Constitutional Tribunal's Jan. 3 ruling. Toledo's revision of the law announced Saturday retained life sentences for the most serious terrorism-related crimes but allowed for the possibility of parole after 35 years.
The penalty for lesser crimes was reduced from life in prison to 25, 30 or 35 years. More revisions in the laws are expected soon.
Many Peruvians worry that the high court ruling might mean freedom for top guerrilla leaders such as Guzman. (Through his attorneys, Guzman has said that he will not immediately seek a new trial.)
"These people who have followed a path of violence for so long will never change," said Rocio Bustinza, a 26-year-old student teacher. "The people will not allow them to be released because they are afraid."
More than 2,000 people remain in prison on terrorism-related charges. For the hundreds who say they were wrongly convicted, this month's ruling offers hope.
Times staff writer Tobar reported from Buenos Aires and special correspondent Holligan from Lima. Times researcher Andres D'Alessandro in Buenos Aires contributed to this report.