A squad of Shining Path guerrillas swept through a village high in the Andes Mountains before dawn Friday and killed 26 villagers with gunfire, machetes and spears in a revenge attack, police said.

They said the raiders struck when most of the people in Carhuampampa, 40 miles northeast of Ayacucho, were still asleep.Police said the attack was to teach the villagers a lesson for forming a self-defense patrol, at the urging of the military, to resist the Maoist-oriented Shining Path.

Officers said the approximately 70 attackers ordered residents from their homes and then opened fire indiscriminately or slashed and stabbed their victims to death. Nine women and 17 men died.

Most of Carhuampampa's 500 residents are refugees who fled even smaller hamlets to escape the Shining Path, police said.

The attack occurred six miles from a military post.

It was the bloodiest onslaught since the Shining Path killed 39 villagers a month ago in Canaire, another hamlet near Ayacucho, which lies 235 miles southeast of Lima.

Authorities reported that Shining Path fighters killed three policemen in the Andes on Thursday, bringing to 24 the number of officers slain by the Maoist rebels in 10 days.

Meanwhile, in Huancayo, 140 miles east of Lima, police found the bodies of two university students and said the killings were political.