Twelve soldiers and seven civilians have been killed in a bomb attack by rebels in a remote coca-growing region of south-east Peru, the military said.
A military convoy was returning to base when a device hidden under one of the vehicles exploded. The survivors were then caught up in a gun battle.
The armed forces blame the Shining Path group, which wrought havoc in Peru during the 1980s and early 1990s.
It is the worst attack in a decade by the Maoist-inspired organisation.
The surviving soldiers returned fire on the rebels for several hours. Peru's military command said women and children were among those killed.
Many more were injured during the attack in the Andes mountains, at Huancavelica province.
It came amid reports that Peru's army had launched an operation to remove some 300 Shining Path rebels who work closely with cocaine traffickers in the region.
The BBC's Dan Collyns in Lima says soldiers killed in the attack were part of that operation, which is focused on isolated jungle in the Ene-Apurimac valley - a hotbed for traffickers and guerrillas.
Our correspondent says the number of confrontations between the armed forces and the rebel groups, which the authorities call "narco-terrorists", is increasing.
In the 1980s and 1990s the guerrilla group attempted to impose a communist regime. Almost 70,000 people were killed during the violence.
However, the conflict has been largely dormant in recent years, and analysts say the Shining Path is a fraction of its former size.