In “Experimenter,” an aesthetically and intellectually playful portrait of the social psychologist Stanley Milgram, the director, Michael Almereyda, turns a biopic into a mind game. It’s an appropriate take on a figure who’s best remembered for his experiments in which subjects delivered punishing electric shocks on command. Working in the shadow of the Holocaust, and shortly after the capture of the SS official Adolf Eichmann, Milgram (1933-1984) was interested in questions of authority, conformity and conscience. “Could it be that Eichmann and his million accomplices in the Holocaust were just following orders,” Milgram asked. “Could we call them all accomplices?”

The restlessly original Mr. Almereyda comes at this question inventively, sometimes with Milgram — a delicate, sensitive Peter Sarsgaard — talking right into the camera. Mr. Almereyda has a boundless gift for finding new ways to tell old stories, and “Experimenter,” as befits its title, is less a straight biography than a diverting gloss on human behavior, historical memory and cinema itself. It’s a story about a man whose work was haunted by the death camps, was conducted as the United States escalated its presence in Vietnam and was destined to speak to the ages (to the abuses at Abu Ghraib and beyond) because his subject — the all too human being — is reliably barbaric. (Mr. Almereyda’s films include the vampire tale “Nadja” and several Shakespeare adaptations, including a superb “Hamlet” with Ethan Hawke.)

Mr. Almereyda takes Milgram, his work and ideas seriously but doesn’t suffocate them: Despite the story’s freight, the laboratory shocks and Milgram’s insistent melancholia, “Experimenter” is a nimble, low-frequency high. Mr. Almereyda’s self-conscious approach to the material hovers between the quasi-Brechtian and the gently absurd (as a director, his eyebrows are raised, not jumping), which keeps the story and characters grooving right along and ensures that while the past informs the story, it never torpedoes it. Milgram turns out to be somewhat of a downer, understandably so given his interests and the later harsh, career-damaging criticisms of his most famous work. His is very much a voice of the 20th century, but as he chronicles the age with Eeyore-like mournfulness he can also feel like one of history’s comedic straight men.

Milgram conducted his first obedience experiments in 1961 at Yale, where he was an assistant professor. “I set up a simple experiment,” he explained, “to test how much pain an ordinary citizen would inflict on another person simply because he was ordered to by an experimental scientist.” Individual test subjects — the ordinary citizens — were ushered into a room where a facilitator (called the experimenter) said the participant (called the teacher) would be administering electrical shocks to another participant (a middle-aged man called the learner) when the learner made a mistake. The teacher was to deliver the shocks via a bland apparatus that looked right out of a first-generation “Star Trek” episode and ostensibly zapped out 15 to 450 volts.

It was all a sham: The learner was a confederate of the experiment, the teacher was the actual subject, and Milgram, of course, was the great experimenter, who, film director-like, watched his little fictions unfold from behind a two-way mirror. The movie opens just as one test is about to begin, with Milgram busily scribbling notes while talking aloud about his intentions. An assistant is parked next to him, but Milgram — as he often does — is addressing us. Inside the lab, a newly arrived, nervous teacher (the cannily cast Anthony Edwards) is settling in, meeting the blustery jolly learner (Jim Gaffigan) under the supervision of an experimenter (John Palladino) who’s wearing a lab coat, a funeral director’s poker face and a head of brilliantine hair.

What did Milgram learn from his experiment? What did history? Mr. Almereyda circles around these questions slyly, poking at them (testing them) amid an occasional soliloquy and assorted biographical snippets, some featuring an excellent, wild-eyed Winona Ryder, who plays Sasha, Milgram’s wife. As he mixes austerely dressed sets with overtly artificial tableaus, Mr. Almereyda seems to be suggesting that Milgram, in his quest for truth, ended up living in a world that hovered between the real one and one of his own imagination. At one point, Mr. Almereyda, with delectable wit, introduces an elephant, which, as it lumbers behind Milgram, raises the question that haunts every room in this movie: Did his experiments finally turn Milgram into a kind of accomplice?