In the ensuing days, the guards became ever more sadistic, denying the prisoners food, water and sleep, shooting them with fire-extinguisher spray, throwing their blankets into dirt, stripping them naked and dragging rebels across the yard.

How bad did it get? The guards ordered the prisoners to simulate sodomy. Why? Because the guards were bored. Boredom is a powerful motive for evil. I have no idea how much worse things might have gotten.

Q. Why did you pull the plug on the experiment?

A. On the fifth night, my former graduate student Christina Maslach came by. She witnessed the guards putting bags over the prisoners’ heads, chain their legs and march them around. Chris ran out in tears. “I’m not sure I want to have anything more to do with you, if this is the sort of person you are,” she said. “It’s terrible what you’re doing to those boys.” I thought, “Oh my God, she’s right.”

Q. What’s the difference between your study and the ones performed at Yale in 1961? There, social psychologist Stanley Milgram ordered his subjects to give what they thought were painful and possibly lethal shocks to complete strangers. Most complied.

A. In a lot of ways, the studies are bookends in our understanding of evil. Milgram quantified the small steps that people take when they do evil. He showed that an authority can command people to do things they believe they’d never do. I wanted to take that further. Milgram’s study only looked at one aspect of behavior, obedience to authority, in short 50-minute takes. The S.P.E., because it was slated to go for two weeks, was almost like a forerunner of reality television. You could see behavior unfolding hour by hour, day by day.

Image Scenes from his 1971 study at Stanford University in which students were told to be prisoner or guard; the results were echoed at Abu Ghraib. Credit... Philip G. Zimbardo

Here’s something that’s sort of funny. The first time I spoke publicly about the S.P.E., Stanley Milgram told me: “Your study is going to take all the ethical heat off of my back. People are now going to say yours is the most unethical study ever, and not mine.”