The film is based on real events. The Stanford Prison Experiment was conducted in 1971 by American psychologist Philip Zimbardo. The experiment was carried out to study people's susceptibility and obedience.
If on the first day the personal characteristics of the "prisoners" influenced their behavior, by the fourth day the depression of the "prisoners" illustrated the absolute uniformity of obedience among all "prisoners." One of the results of this experiment is that situations influence human behavior more than internal personality traits. The "prisoners" also found excuses for what they endured, reassuring themselves that it was just an experiment and they could leave the "prison" at any moment.
It is interesting how the "guards" justified their cruel actions: they referred to authorities—the professor and the experiment's assistants. The experiment's results showed that one in three "guards" exhibited sadistic tendencies, and cruelty is easily justified when an ideology that approves of such actions is present. Notably, the professor himself "got carried away" with the experiment along with the "guards" and began justifying his reluctance to stop it.