Abimael Guzmán, the mastermind of the Shining Path terrorist organization in Peru, a brutal Maoist movement that nearly toppled the country’s government in the 1980s and early 1990s, leaving thousands of people dead, died Sept. 11 in a hospital at a military prison outside Lima. He was 86.

Peru’s justice minister, Aníbal Torres, announced the death, saying the cause was an infection.

Mr. Guzmán, a onetime philosophy professor and longtime Communist Party member, traveled to China in the 1960s and became a devotee of Mao Zedong and the Cultural Revolution, a repressive movement meant to reorder Chinese society.

Calling himself “President Gonzalo,” Mr. Guzmán devised a set of principles based on Maoist thought as the guiding ideals of the Sendero Luminoso, or Shining Path, a term derived from an earlier leader of Peru’s Communist Party.

Building a stronghold at a provincial university in Ayacucho in the Andes Mountains, Mr. Guzmán proved to be a charismatic leader whose followers — mostly students and small farmers — considered him a godlike figure. They called him the Fourth Sword of Marxism, after Karl Marx, Russian revolutionary Vladimir Ilyich Lenin and Mao. A U.S. State Department official once described him as “Charlie Manson with an army.”

Mr. Guzmán advocated a violent takeover of Peruvian society, maintaining that true revolution would come only after crossing a “river of blood.” To him, even the Cuban regime of Fidel Castro and the Chinese leaders who succeeded Mao were too soft. His vision of nationalism resembled that of Cambodia’s Pol Pot, whose regime killed nearly a quarter of the country’s population.

Mr. Guzmán sought to abolish banks, money and large-scale industry and aimed to reshape Peruvian life as a proletarian utopia, made up of farmers and craftspeople trading through barter.

“Judgment day has arrived,” he told his followers in 1980, just as the Shining Path’s effort to overthrow the country was beginning. “The future lies in guns and cannons.”

At first, Peruvian officials paid little attention to the movement, which began with the takeover of town halls in rural areas, bombings at polling stations and assassinations of local leaders. By 1981, Shining Path guerrillas had extended their reach to the capital of Lima, announcing their arrival in a particularly gruesome way: by hanging the carcasses of dozens of dead dogs from lampposts, as a warning to “capitalist dogs” and to anyone unwilling to follow Mr. Guzmán’s doctrinaire ideas.

“Violence is a universal law,” he said in 1988. “Without revolutionary violence . . . you can’t overthrow an old order to create a new one.”

Authorities seemed helpless against the Shining Path, as guerrillas disrupted Peru’s electrical system, food and water supplies. Police stations were raided for guns, and bombs were set off in theaters and restaurants, putting the entire nation, then numbering about 20 million people, on edge.

The group financed its widespread campaign of terror through bank robberies and by seizing airstrips used by drug dealers in remote parts of Peru. They demanded huge payoffs from cocaine kingpins, who appeared to be afraid of Mr. Guzmán’s guerrillas.

Kidnapping and murder were key parts of the Shining Path’s ruthless mode of operation, and bodies began to pile up around the country. The first large-scale massacre took place in 1983 in the town Lucanamarca, where 69 people — including the elderly and at least 18 children — were killed with machetes, axes and a vat of boiling water.

“The main thing was to make them understand that we were as tough as a bone, and ready to do anything,” Mr. Guzmán said afterward. “They were facing a different type of fighter.”

In 2003, a Peruvian truth and reconciliation commission determined that almost 70,000 people had been killed in the 1980s and 1990s — about half by Shining Path terrorists and the other half by the government’s police and military forces. Most of the victims were concentrated among Peru’s poor, Indigenous people in rural regions, where Mr. Guzmán had his strongest support.

For years, Mr. Guzmán remained a wraith, invisible to authorities whose efforts to capture him proved futile. By 1990, the Shining Path controlled a substantial part of the Peruvian highlands and countryside. More than 100 local officials had been assassinated in the preceding year, and a third of the country’s courts were idled because they did not have judges. Nearly three-quarters of the country was placed under a state of emergency or virtual martial law.

In 1990, Alberto Fujimori was elected Peru’s president, promising to snuff out the Shining Path and bring Mr. Guzmán to justice. On Sept. 12, 1992, in an operation later found to have been supported by the CIA, Peruvian police raided a house in a middle-class district of Lima, arresting Mr. Guzmán in his hiding place on the second floor above a dance studio. Photographers snapped pictures of him wearing a striped prison outfit, shouting revolutionary slogans in his cell. It was called the “capture of the century.”

After denouncing the notion of human rights, Mr. Guzmán changed his position a year later, when he was convicted of treason and sentenced to life in prison. His second-in-command in the Shining Path movement, Elena Iparraguirre, also received a life sentence. (She assumed her role after Mr. Guzmán’s first wife, Augusta La Torre, mysteriously died in 1988; there were suggestions that she was either murdered or died by suicide.)

Mr. Guzmán said the Shining Path movement would continue, but it soon fell apart without him.

His first trial, conducted by a military tribunal, was declared unconstitutional. A second trial in 2004 before a civilian court ended in chaos, with Mr. Guzmán and 15 co-defendants raising their fists and defiantly chanting, “Glory to Marxism, Leninism and Maoism” and “Long live the people’s heroes.”

Mr. Guzmán was tried again in 2006 and found guilty of “aggravated terrorism.” He and Iparraguirre, who had been jailed together for several years, were married behind bars in 2010. They were then assigned to separate men’s and women’s prisons. In 2018, Mr. Guzmán was convicted of further crimes related to a 1992 bombing.

Manuel Rubén Abimael Guzmán Reynoso was born Dec. 3, 1934, in Mollendo, Peru. His father was a merchant who had children with several women. Mr. Guzmán lived with his mother until he was sent to a Catholic school.

He later studied at the Universidad Nacional de San Agustín, a state university in Arequipa, Peru. In the early 1960s, he joined the faculty at the Universidad Nacional San Cristóbal de Huamanga in Ayacucho and became caught up in leftist politics. He quit teaching in 1974 to focus on organizing the Shining Path.

In the years since Mr. Guzmán was first imprisoned, Peru has hardly been free of political strife. Fujimori, the president once hailed as a national hero after Mr. Guzmán was captured, later was convicted of corruption and human rights abuses. Fujimori’s onetime security chief, Vladimiro Montesinos, has been in prison since 2006 — for much of that time in the same maximum-security military facility in which Mr. Guzmán was held.

Over the years, occasional acts of violence in Peru, including as recently as this year, have been attributed to remnants of the Shining Path insurgency.

Mr. Guzmán’s supporters had once believed that “President Gonzalo,” as they called him, had magical powers that made him impervious to the laws of the universe, let alone the laws of a nation. They were shocked, after he was arrested and convicted, at how quickly he called off his revolution and sought a peaceful arrangement with the government.

“The myth of the all-powerful Gonzalo prevents people seeing Guzmán for what he is,” Carlos Tapia, who had known Mr. Guzmán during his academic life, told the Guardian newspaper in 1993. “He himself isn’t a fighter and has never seen death close [up]. He’s a bureaucrat administering a machine of death which he created.”