The Constitutional Court was examining legislation allowing rebel suspects to be tried for treason by military tribunals.
"
I expect a great deal of debate and criticism, both
international and domestic, to follow this ruling
"
Javier Alva Orlandini, Court President
The measures were passed under the former president, Alberto Fujimori, to help quash left-wing guerrilla movements in the 1990s.
The court's president, Javier Alva Orlandini, said the Peruvian legislation did not comply with international human rights standards.
'Unconstitutional'
The court concluded that it was unconstitutional for military tribunals to try civilians.
It also ruled that life sentences handed down to rebels convicted of terrorism are an unconstitutionally excessive punishment.
The ruling affects about 900 people, and could allow Moaist Shining Path movement leader Abimael Guzman to demand a retrial in civilian courts.
"It doesn't order a new trial, but it opens the possibility," Mr Alva said.
The court's president said the decision brings Peru in line with rulings by the Inter-American Court of Human Rights, the legal arm of the Organisation of American States.
The Inter-American court had directed Peru to reform its anti-terrorism legislation.
"I expect a great deal of debate and criticism, both international and domestic, to follow this ruling," Mr Alva said.
He added the ruling should not affect the case of jailed American Lori Berenson, 33, who was originally sentenced to life imprisonment by a military court in 1996.
She was later retried in an open civilian court, where her sentence was reduced to 20 years.
Decision attacked
On Thursday, Mr Fujimori criticised the expected ruling from Japan, where he has been living in self-imposed exile since fleeing a corruption scandal in 2000.
"It seems the current government has forgotten that hell, has forgotten the 30,000 people killed by barbaric terrorism," he said in a videotaped statement released in Lima.
Mr Fujimori imposed the laws in 1992, after more than a decade of bloody rebel conflict.
The authoritarian measures included harsh prison sentences and the use of military tribunals.
The secret hearings were designed to protect magistrates from reprisal attacks by rebels. Judges were often the target of death threats, making them reluctant to deliver guilty verdicts against guerrillas.
Until the early 1990s, rebel groups waged a campaign of car bombings, political assassinations and massacres of peasants who refused to support them.
The Shining Path's power waned after Guzman was captured in 1992.
Membership of the guerrilla group, which once boasted about 10,000 members, has dwindled to about 500.
Nearly 30,000 people died in rebel violence in Peru between 1980 and the early 1990s, including guerrillas, members of the security forces and civilians.