Writer and director Peter Berg talks to Boston Magazine about the challenges he and star Mark Wahlberg faced in making “Patriots Day.”

Leading into this film, you and Mark Wahlberg talked a lot about “getting it right.” What did that mean to you?

I think there were a couple of different areas that I was more concerned about in terms of getting it right. One being just literally the facts: What happened? Who did what, where, and how? What role the different law enforcement agencies had, including the FBI, and the experience of the EMT workers, the firefighters, the hospital workers, some of the victims we worked with in the film. I was interested in trying to explore whether there was any logical explanation for this barbaric behavior. I wanted to do everything I could to make sure that we did the research to really get a clear understanding of what transpired.

Why was it important for you to make sure that actual Bostonians were involved in the movie?

Well, I think that in general many other films have done it, writing in real people. When I did a film about Navy SEALs, I had as many SEALs as I could. Real cops playing cops, real paramedics playing paramedics—that’s just something that I believe in, it’s kind of the style of moviemaking that I like. For Patriots Day, I had the opportunity to get the real men and women working on the SWAT teams, that were driving ambulances to hospitals. It made everybody on my side pay a little more attention and work harder knowing that these guys really went through this.

Did you feel like the production of this film went smoothly?

I would say it went smoothly. The biggest challenge was doing everything I could to make sure that in our effort to get the facts right, we met with as many people who were directly involved in or affected by the bombings as possible. We spent a lot of time sitting down with people—hearing their stories and listening to their concerns and processing those concerns—as I was trying to shape what the movie would be. Balancing the community’s concerns with the narrative of the film, that was challenging, but that kind of challenge is what inspires me. It’s what gets me so excited to make films.

So how do you walk that tightrope?

I think it’s a matter of taste. I think there’s an invisible line, and you know when you cross it in terms of sensationalizing something or overhyping something or being gratuitous. I talked to many of the victims, the people who were there when the bombs went off. We talked about how the movie was going to portray the immediate aftermath of the explosion, since it was obviously a very traumatizing environment. People were concerned and wanted to know how theatrical it was going to be, and my answer was, “We’ll know when we go too far; we’ll make sure we don’t.” One of the reasons to make a movie like Patriots Day is so people never forget exactly how vicious and diabolical that crime was. In order to do that, we can’t shy away completely from the intensity. But we have to be conscious that there is a line. I think that we found the right balance.

What perspective did Wahlberg bring to Patriots Day, and why do you think he felt the need to be a part of it?

With Mark there’s a little added—a lot of added—pressure and responsibility, because he’s so popular in Boston, so well known. I think he really wanted to be a part of this story because of that connection to the city. It’s clear to me that he not only deeply loves Boston, but also carries Boston with him wherever he is. His inner circle, his best friends—the original entourage, the really great guys he’s known since he was six or seven years old growing up in Dorchester—these are the people with him every day. I think that he felt that this story was important to tell and that he felt that he should be a part of it.

I’m not from Boston—I’m a New Yorker—and I was able to spend time with Mark. I would drive into the city and he would show me different streets and different corners. He showed me where he got arrested, and where he kissed his first girl, and where he grew up. It was a great opportunity to see just how connected to the community he is and get a real sense of this actor and how much he’s achieved.

I’m going to go with Boston local John Enos, who plays a Boston cop. His accent was probably the most impeccable.

Why did you choose to include David Ortiz in the film?

Everyone has a personal experience during that period of time. David talked about how the Red Sox went on a road trip right after the bombings, but he was hurt so he stayed in Boston, and when the order to shelter in place was given, he understandably had to shelter in place. He talked about how scared he was and how angry he got. I think that being in Boston throughout that, being locked in his house like everyone else, fueled that fire that came out when he gave that very memorable speech. I think I was in California when I watched him give that speech, and I was getting goose bumps and tears in my eyes. It was undeniably powerful—a very organic moment. We wanted to do some additional work with David around that in the movie. I’m not going to tell you what we did yet. You’ll have to see it.