On the morning of August 17, 1971, nine young men in the Palo Alto area received visits from local police officers. While their neighbors looked on, the men were arrested for violating Penal Codes 211 and 459 (armed robbery and burglary), searched, handcuffed, and led into the rear of a waiting police car. The cars took them to a Palo Alto police station, where the men were booked, fingerprinted, moved to a holding cell, and blindfolded. Finally, they were transported to the Stanford County Prison—also known as the Stanford University psychology department.

They were willing participants in the Stanford Prison Experiment, one of the most controversial studies in the history of social psychology. (It’s the subject of a new film of the same name—a drama, not a documentary—starring Billy Crudup, of “Almost Famous,” as the lead investigator, Philip Zimbardo. It opens July 17th.) The study subjects, middle-class college students, had answered a questionnaire about their family backgrounds, physical- and mental-health histories, and social behavior, and had been deemed “normal”; a coin flip divided them into prisoners and guards. According to the lore that’s grown up around the experiment, the guards, with little to no instruction, began humiliating and psychologically abusing the prisoners within twenty-four hours of the study’s start. The prisoners, in turn, became submissive and depersonalized, taking the abuse and saying little in protest. The behavior of all involved was so extreme that the experiment, which was meant to last two weeks, was terminated after six days.

Less than a decade earlier, the Milgram obedience study had shown that ordinary people, if encouraged by an authority figure, were willing to shock their fellow-citizens with what they believed to be painful and potentially lethal levels of electricity. To many, the Stanford experiment underscored those findings, revealing the ease with which regular people, if given too much power, could transform into ruthless oppressors. Today, more than forty-five years later, many look to the study to make sense of events like the behavior of the guards at Abu Ghraib and America’s epidemic of police brutality. The Stanford Prison Experiment is cited as evidence of the atavistic impulses that lurk within us all; it’s said to show that, with a little nudge, we could all become tyrants.

And yet the lessons of the Stanford Prison Experiment aren’t so clear-cut. From the beginning, the study has been haunted by ambiguity. Even as it suggests that ordinary people harbor ugly potentialities, it also testifies to the way our circumstances shape our behavior. Was the study about our individual fallibility, or about broken institutions? Were its findings about prisons, specifically, or about life in general? What did the Stanford Prison Experiment really show?

The appeal of the experiment has a lot to do with its apparently simple setup: prisoners, guards, a fake jail, and some ground rules. But, in reality, the Stanford County Prison was a heavily manipulated environment, and the guards and prisoners acted in ways that were largely predetermined by how their roles were presented. To understand the meaning of the experiment, you have to understand that it wasn’t a blank slate; from the start, its goal was to evoke the experience of working and living in a brutal jail.

From the first, the guards’ priorities were set by Zimbardo. In a presentation to his Stanford colleagues shortly after the study’s conclusion, he described the procedures surrounding each prisoner’s arrival: each man was stripped and searched, “deloused,” and then given a uniform—a numbered gown, which Zimbardo called a “dress,” with a heavy bolted chain near the ankle, loose-fitting rubber sandals, and a cap made from a woman’s nylon stocking. “Real male prisoners don't wear dresses,” Zimbardo explained, “but real male prisoners, we have learned, do feel humiliated, do feel emasculated, and we thought we could produce the same effects very quickly by putting men in a dress without any underclothes.” The stocking caps were in lieu of shaving the prisoner’s heads. (The guards wore khaki uniforms and were given whistles, nightsticks, and mirrored sunglasses inspired by a prison guard in the movie “Cool Hand Luke.”)

Often, the guards operated without explicit, moment-to-moment instructions. But that didn’t mean that they were fully autonomous: Zimbardo himself took part in the experiment, playing the role of the prison superintendent. (The prison’s “warden” was also a researcher.) /Occasionally, disputes between prisoner and guards got out of hand, violating an explicit injunction against physical force that both prisoners and guards had read prior to enrolling in the study. When the “superintendent” and “warden” overlooked these incidents, the message to the guards was clear: all is well; keep going as you are. The participants knew that an audience was watching, and so a lack of feedback could be read as tacit approval. And the sense of being watched may also have encouraged them to perform. Dave Eshelman, one of the guards, recalled that he “consciously created” his guard persona. “I was in all kinds of drama productions in high school and college. It was something I was very familiar with: to take on another personality before you step out on the stage,” Eshelman said. In fact, he continued, “I was kind of running my own experiment in there, by saying, ‘How far can I push these things and how much abuse will these people take before they say, ‘Knock it off?’ ”

Other, more subtle factors also shaped the experiment. It’s often said that the study participants were ordinary guys—and they were, indeed, determined to be “normal” and healthy by a battery of tests. But they were also a self-selected group who responded to a newspaper advertisement seeking volunteers for “a psychological study of prison life.” In a 2007 study, the psychologists Thomas Carnahan and Sam McFarland asked whether that wording itself may have stacked the odds. They recreated the original ad, and then ran a separate ad omitting the phrase “prison life.” They found that the people who responded to the two ads scored differently on a set of psychological tests. Those who thought that they would be participating in a prison study had significantly higher levels of aggressiveness, authoritarianism, Machiavellianism, narcissism, and social dominance, and they scored lower on measures of empathy and altruism.

Moreover, even within that self-selected sample, behavioral patterns were far from homogeneous. Much of the study’s cachet depends on the idea that the students responded en masse, giving up their individual identities to become submissive “prisoners” and tyrannical “guards.” But, in fact, the participants responded to the prison environment in all sorts of ways. While some guard shifts were especially cruel, others remained humane. Many of the supposedly passive prisoners rebelled. Richard Yacco, a prisoner, remembered “resisting what one guard was telling me to do and being willing to go into solitary confinement. As prisoners, we developed solidarity—we realized that we could join together and do passive resistance and cause some problems.”

What emerges from these details isn’t a perfectly lucid photograph but an ambiguous watercolor. While it’s true that some guards and prisoners behaved in alarming ways, it’s also the case that their environment was designed to encourage—and, in some cases, to require—those behaviors. Zimbardo himself has always been forthcoming about the details and the nature of his prison experiment: he thoroughly explained the setup in his original study and, in an early write-up, in which the experiment was described in broad strokes only, he pointed out that only “about a third of the guards became tyrannical in their arbitrary use of power.” (That’s about four people in total.) So how did the myth of the Stanford Prison Experiment—“Lord of the Flies” in the psych lab—come to diverge so profoundly from the reality?