Peruvian soldiers have rescued almost 40 men, women and children kept prisoner for up to three decades by a Communist rebel group.

In an operation lasting nine days that ended on Sunday, the 26 children and 13 adults were taken from “production camps” controlled by the Shining Path in the crime-riddled VRAEM region.

Women were raped and forced to work on the farms while their children, some who were born in captivity, were indoctrinated in the group’s ideology, said Vice-Defence Minister Ivan Vega Loncharich.

The children were taken to an air force base and into care with their mothers (Peruvian Ministry of Defence)

“The aim of this operation was to rescue the people who were hostages of the Shining Path (Sendero Luminoso) in what is called a production camp,” he added.

“Among the rescued adults, there is a 70-year-old woman who was abducted from a nunnery in Puerto Ocopa several decades ago.”

Around 120 soldiers and National Police took part in the raid, airlifting the captives to safety using four military helicopters.

They transferred the former slaves into institutions in a secure location to receive medical care and counselling, the armed forces command said.

“We've been here, like this, for 30 years,” one of the rescued women told La Republica.

The Shining Path has been denounced by the UN for using child soldiers (Joint Armed Forces Command Peru)

The newspaper reported that some of the children had been kidnapped from rural communities where parents feared reporting their disappearance because of reprisals from the Shining Path.

Militants reportedly told the children, aged between one and 14, that the army had come to kill them in efforts to make them run away.

A former prisoner is believed to have led the military to the area after managing to escape the camp last month.

Peruvian drug enforcement policemen walk through a coca plantation in the Apurimac valley rain forest, in southeast Peru. (AFP/Getty Images)

The VRAEM region, which has been ravaged by conflict between the Peruvian army and Shining Path since the 1980s, is one of the world’s largest cocaine-producing areas.

Much of the drugs smuggling is carried out by the Shining Path, which was founded in 1970 as an off-shoot of the Communist Party of Peru to try to enact a Maoist-inspired violent revolution.