A trio of Indonesian men, dressed in elaborate cowboy outfits, are pretending to viciously beat a hugely overweight man who is wearing a curly black wig and a bright satin two-piece gown. Punching and striking the man playing the woman, the cowboys yell that she is a Communist, and that she is pregnant and will give birth to another little Communist. What makes the scene even stranger, more surreal and disturbing than it might otherwise be is that the men in the cowboy suits and the one in the dress belonged to a paramilitary death squad during the anti-Communist purges in Indonesia in 1965, and they are reenacting one of their crimes. The men are the subjects of Joshua Oppenheimer’s brilliant documentary, The Act of Killing, and they are filming a collective biopic about what they did during this most dramatic and exalted period in their lives. The cowboys’ attack on the woman is a scene from their movie.

As The Act of Killing begins, a series of titles outlines the film’s historical background. In 1965 the Sukarno government, which some Western governments feared was sliding into communism, was overthrown and replaced by a military regime led by General Suharto. Blaming the initial coup attempt on the Indonesian Communist Party, the country’s right-wing leaders recruited gangs of thugs to wipe out suspected Communists with messy, improvisatory, but astonishing efficiency; estimates of the number killed during this period range from 500,000 to a million or more.

The death squads’ victims were depicted by the Indonesian government and the press as vicious Communists conspiring to destabilize the nation and enslave its citizens. Included among these “Communists” were landless farmers, intellectuals, and union members, along with anyone the government didn’t like or whose money the killers wanted. The American government supported the regime’s harsh and thorough anti-Communist programs, and, worried that Indonesia’s tens of thousands of ethnic Chinese might feel some bond with the People’s Republic of China, our intelligence services suggested that the Chinese population be killed along with the rest.

But among the interesting and unusual choices that Oppenheimer makes is his decision to forego the structure of the documentary whodunit—Who gave the orders? Who in Washington knew? Instead, he concentrates on the killers themselves: who they are, how they see their lives, and the bizarre and appalling film they are enthusiastic to make about what they did. Rather than exploring the theory that the tensions generated by Muslim sectarianism were exacerbated to fuel the massacres, Oppenheimer shows us the gangster-actors suspending a torture scene to listen in respectful silence to the chanting of the evening prayers from outside. In its revealing examination of the genesis of moral conscience and of the psychology of evil, The Act of Killing is less like any film I can recall than like journalist Gita Sereny’s book-length interviews with Albert Speer and the commandant of Treblinka.

Eerily, the Indonesian gangsters whom Oppenheimer interviews began their underworld careers outside a movie theater in their native city of Medan, North Sumatra, where, as teenage punks, they set up a movie-ticket-scalping operation. They all admired the same idols—John Wayne, James Dean, Victor Mature, later Al Pacino—and aspired to dress, behave, and kill with impunity, like Hollywood tough guys. Their big grudge against the Communists was that the leftists were demonstrating outside theaters showing American movies. The Communists hated American movies. So they had to be killed. Otherwise, the gangsters don’t talk about how they were recruited to be killers. One day they were selling cinema tickets in the street, the next day they were crossing the street to torture and behead.

When, under the military regime, their new responsibilities required new professional skills, they learned from the movies that garroting was a relatively quick and bloodless technique of execution. Anwar Congo—the elderly former gang leader on whom The Act of Killing increasingly comes to focus—recalls dancing across the street to do his grisly job after he’d seen a tuneful Elvis Presley movie. “It was like we were killing happily.” I thought of the 2008 Italian film, Gomorrah, of the scenes in which the two novice Neapolitan hoods mimic their role model, Scarface, and it crossed my mind that Al Pacino might have done some damage.

When Oppenheimer proposed making a film about them, the former death-squad commandos had seen too many action thrillers to agree to appear onscreen as talking heads. They wanted to produce a feature about their crimes that would combine stylistic elements of the cowboy shoot-‘em-up, the musical, the gangster noir, the mafia film, the 1950s Hollywood Nazi picture—and the Bollywood extravaganza! What they had in mind, in other words, was a pastiche of their favorite genres, except that it would be about them—how they interrogated and tortured, how they used the garrote, how they carried out mass executions, and raped women and girls—and they would have creative control.

Their cinematic vision turns out to contain aspects of comedy (one big bully seizes every chance to squeeze into outrageously tight gowns and feather headdresses that might have seemed excessive to Divine) and even hallucinogenic beauty. In a recurrent and haunting scene, a gigantic prop—a structure like a cross between a prehistoric fish and a Boeing 747—disgorges a procession of lovely, brightly costumed dancers swaying against a candy-colored, tropical dream landscape. The actors are eager to watch their work-in-progress, and Oppenheimer records their responses to seeing themselves on film.

One explanation for the criminal auteurs’ lack of contrition for their crimes, Oppenheimer suggests, is the continued inability of the Indonesian government to come to terms with the massacres itself. The country’s repressive government has remained in power and none of the murderers have been brought to justice. Indeed, in Indonesia today, there seems to be hardly any interest in truth and reconciliation, testimony and trials. The Act of Killing is being downplayed there, denied popular distribution, and there have been threats against Oppenheimer and the people who helped him make the film.

On screen, one unrepentant murderer mocks the notion of human rights: “The Geneva conventions may be today’s morality,” he says, “but tomorrow we’ll have the Jakarta Conventions and dump the Geneva Conventions. War crimes are defined by the winners. I’m a winner. So I can make my own definition.” In one of many startling scenes, Anwar Congo appears on a TV talk show to discuss the movie he and his friends are filming and to boast about all the Communists he murdered. The studio audience applauds. Segments in which the killers debate details of costume, make-up, and verisimilitude (“Don’t tie the blindfold so tight!”) are intercut with recent footage of parades and demonstrations staged by the country’s enormous paramilitary organization, the Pancasila Youth—the same organization that in 1965 and 1966 worked with the gangster squads to eliminate Communists.

Anwar Congo, now a grand old man, was a founding father of both. He and his friends are the Pancasila Youth’s history and their heroes. Addressing a Pancasila rally, Jusuf Kalla, vice president of Indonesia from 2004–2009, celebrates the glory of the “free gangster” and regrets the occasional necessity of beating people up. The vulgarity and menace of such rhetoric are matched only by the aggressive counter-intuitiveness of the paramilitaries’ military fatigues, patterned with muddy splotches against a flamingo-pink background: For people like us, the uniforms suggest, day-glo camouflage is not an oxymoron. We want the enemy to know we are here, in force—and to fear us.

Like his cohorts, Anwar is a dandy with an idiosyncratic, flashy style; he sleeps near his enormous wardrobe rack and his oversized mirror. He dyes his hair to look younger and provides helpful instruction on the dress code (no white pants, please!) appropriate for a bloodbath. Anwar’s friends tease him about his African looks, calling him Idi Amin, but the person he most (physically) resembles is Nelson Mandela—a fact that no one mentions.

Anwar and his friends’ attention to style is connected to another of the film’s subjects: the complex nature of performance, and of violence as a form of performance art. The thugs monitor themselves and each other, and gently correct their friends’ reenactments of interrogations and beatings. Preparing to dramatize their past actions on screen, they debate the subtle but all-important difference between cruel and sadistic.

As in many dictatorships, language is distorted to serve the aims of the state. Here, everyone appears to believe that gangster derives from the same etymological root as free man. Many of the executions occur on the patio of a newspaper office across from the movie theater where the men got their start, and the paper’s publisher explains why the murders, and the propaganda justifying them, were necessary. Present at the interrogations, journalists altered whatever the prisoners said, “to make them look bad. My job was to make the people hate them.”

Fascinated by the action on screen, we might almost overlook the skill with which The Act of Killing has been conceived, edited, and directed. Shown a rough version of the film, Werner Herzog and Erroll Morris were sufficiently impressed to sign on as executive producers, and Herzog has described the documentary as one of the most powerful he’s seen in a decade. Early on, Anwar Congo—who, we hear, was personally responsible for killing over a thousand people—mentions his bad dreams. Filmed amid his extended family, surrounded by beloved grandchildren, he describes having nightmares brought on by the dawning realization that the people he killed didn’t want to die. He cannot forget the open eyes of a man he beheaded in a forest, and soon his dreams are such common knowledge that a scene—“Anwar’s nightmare”—is written into the script.

Later, a turning point is reached when Anwar cannot finish a scene in which he’s playing a torture victim about to be executed. His terror, his helplessness, and his loss of dignity are too powerful, too real. His hand shakes as he signals a discomfited fellow actor, the fat drag queen, that he can’t go on. Soon after, we watch a jaw-dropping sequence (one of the Bollywood-esque numbers) in which a troupe of beautiful women sing “Born Free” in front of waterfall. Two men playing dead Communists remove the garrotes from their necks and present Anwar, robed in priestly black, with a medal; they thank him for having killed them and sent them to heaven.

Anwar loves the scene by the waterfall, the dead rising to thank him—to reward him—for freeing their souls from their bodies. He couldn’t be more proud. Then he asks to watch the torture scene he’d quit partway through. In yet another odd turn, he summons his grandchildren (we can hear Oppenheimer asking Anwar if he’s sure about this) to watch Grandpa. Look at Grandpa’s face, all bloody and beaten. Don’t be scared. It’s a movie! What is he trying to tell them? And what is he trying to figure out from the way they react? Squirming on his lap, the two little boys watch in obvious discomfort.

After they leave, Anwar says that while he was enacting the scene, he’d felt it—he’d felt the terror his victims experienced. And Oppenheimer, who until now has been a neutral presence, calmly points out that what his prisoners felt was much worse, because Anwar knew it was only a movie, and they knew they were going to die.

Dressed in a spiffy mustard-colored suit, Anwar revisits the patio (the former newspaper office is now a shop selling gaudy handbags) where so many killings took place. The spring in his step has vanished. Pacing the terrace, he suffers an attack of the dry heaves. He goes on retching—violently, reflexively, without relief or hope. It’s impossible to feel sorry for Anwar and equally impossible to remain unaffected by his remorse and grief. Watching him doubled over, gagging in his dandyish ochre suit, is like watching someone trying to vomit up an irritant: the residue of his soul.

Joshua Oppenheimer’s The Act of Killing is showing at New York’s Sunshine Cinema Theater starting July 19.