Viewers of the psychopharmacology-themed thriller Side Effects (out Feb. 8), from director Steven Soderbergh and writer Scott Z. Burns, may begin to question what parts of the movie are real and what’s not. But while the movie’s plot may take cues from One Flew Over the Cuckoo’s Nest, its inspiration was very much grounded in reality, says forensic psychiatrist Dr. Sasha Bardey, one of the film’s producers. Bardey, a consultant on NBC’s Law & Order: Special Victims Unit and Law & Order: Criminal Intent, was present in the development of Side Effects from the very beginning. In fact, some of his actual cases inspired scenes between the movie’s doctor (Jude Law) and patient (Rooney Mara). Bardey spoke to TIME about the movie, the importance of how mental illness is depicted on screen, and why psychiatrists are like detectives.

TIME: What does it mean to be a forensic psychiatrist?

Bardey: A forensic psychiatrist is a psychiatrist who’s had some additional training and experience working in the area of psychiatry and the law. I’ll give you an example: in the criminal world, if someone is claiming to be insane at the time that they committed a murder, a forensic psychiatrist will be called to do an evaluation and render an opinion about that. In a civil situation, if someone is claiming to be too depressed and disabled to work, then a forensic psychiatrist will be called to evaluate the person.

How did you get involved in consulting for TV and movies?

I was working at Bellevue Hospital in New York City, on the prison ward, where we treated the severely mentally ill from Rikers Island. While I was there, [director] Peter Berg was putting together a pilot for a TV show called Wonderland. I became a consultant for the TV show, and it was there that I mer Scott Burns, who is the writer and producer of Side Effects. That must have been just over 10 years ago. We decided it would be great to create a story around some of the experiences we had had at Bellevue, and Side Effects was born.

So were the events in the movie based on real cases?

Yes, they were either based on—or inspired by—actual cases. But most of the action that you see in the movie is derived from real incidents that occurred. What makes the movie fictional is that it all happens to one person and to one psychiatrist over time, whereas in reality, these were all elements from different cases and different experiences.

I certainly approached it with that in mind: I’m here to create accuracy. But then I realized that, especially when you’re working in situations where I’m not involved from the beginning, it’s a matter of balancing accuracy with the demands of show business. As my consulting as evolved, I’ve begun to try to see it through the eyes of the artist. Otherwise, you hit a wall. You say, ‘The only way this could be realistic is this way.’ And they say, ‘Well, we can’t do it that way because we don’t have that much time, we don’t have these characters, it has to be done in this room in the next hour…’ In this movie, from the get-go, Scott wrote it and I helped him with the twists and turns which are psychiatric in nature. And they went to great lengths to achieve a level of realism, down to—although you can’t really see them in the movie because they’re blurry in the background—the diplomas on the wall, the books on the shelves, the paperwork on the desk. It’s copied from reality.

Why does it matter to maintain a certain level of accuracy in depictions of mental illness and psychiatry?

On one hand, to make a story credible and entertaining, the more realistic the backdrop that you depict, the more willing someone’s going to be to believe it. It’s like special effects in movies. If the effects are great and credible, you really suspend disbelief and buy into it. But, very specific to me, it’s important that psychiatry, psychiatrists, mental illness and patients be depicted in a realistic way, because my field suffers a great deal from a stigma around it. And the only way I think to get rid of that stigma is to be realistic about those issues. And not just the good parts. I’m not talking about painting a beautiful lily-white picture of what mental illness or its treatment is. But to look at it realistically—the good and the bad—and have people accepting it for what it truly is.

Without giving the plot away, what was the hardest part of the movie in terms of achieving that accuracy?

I think a challenging part for the actors and for me was to somehow find a way of riding that line between making certain things credible and believable—while raising a certain amount of doubt as to what was really going on. Finding that line was very challenging.

In your experience, is it possible to tell when somebody is not telling the truth?

That’s a very, very interesting question. In a one-to-one encounter, it’s really difficult to tell whether someone is lying or telling the truth. The only way to really find out is the do a much more in depth analysis. That’s what I do as a forensic psychiatrist—and that’s what differentiates me from a clinical psychiatrist. If you go see a clinical psychiatrist and you walk in and say, ‘I’m depressed,’ they have no reason not to believe you. But in the forensic realm, if someone says, ‘I was hearing voices telling me to kill that person,’ I have my doubts because there’s so much at stake here.

So, just like in the movie, there are a lot of similarities between a psychiatrist and a detective.

Correct. He’s got to get to the bottom of what really happened. Detectives do “Who done it?” Psychiatrists do “Why done it?”