On April 15, 2013, two brothers of Chechen origin set off homemade bombs at the finish line of the Boston Marathon. More than 250 people were injured and three died, including an 8-year-old boy. In the days that followed, the attackers were identified through patchwork security footage, and one of the country’s great cities was essentially shut down in the ensuing manhunt.

“I came right to the city” after the bombing, says Wahlberg, who stars in “Patriots Day.” “I had never seen it like that. Deserted. Streets were pretty much empty. It was an eerie feeling.

“It happened as the weather started to turn, the first days of spring. It’s such a celebratory occasion, people running (the marathon) for various causes, so emotional when they finish the race. I remember at a very early age, before my parents would allow me to get on the train, we’d just sneak on the train, go downtown and spend the day in the middle of this joyous occasion.

“To think of the unthinkable happening — there were families, women and children — it’s … it’s just hard to fathom.”

Wahlberg was active in the recovery efforts that became known across the country by the rallying cry “Boston Strong.” When competing studios began to develop movies on the incident, the Oscar-nominated local hero got involved. The two projects were eventually combined into one: The Wahlberg-starring-and-produced, Peter Berg-directed “Patriots Day.”

“There was obviously a lot of concern when it got around we were making this movie. And I felt the same thing,” says the actor. “But they were going to make the movie regardless, so I said, if they’re going to make the movie, then I’m going to be involved and I’m going to be in control and I’m going to make sure they do it right. Once people realized it was me, I think they felt a sense of relief. … I was one of them. And they knew that they could hold me accountable.

“People would continue to tell me, ‘Don’t screw it up. Make sure you tell them who we are.’”

In the midst of what he calls skeptical local news coverage about the film project, Wahlberg went to a Celtics game with his family.

“They were down like seven points, and one of the players shot a basket, made it, pointed at me and they put me on the Jumbotron,” he says. “People started going crazy, chanting, ‘Boston Strong!’”

The Celtics came back to win, and when the Wahlbergs left, a crowd “came out and surrounded our car. My kids were worried; they didn’t know what was going on. I got out of the car and they started chanting, ‘Boston Strong.’”

Wahlberg’s character in “Patriots Day” is an amalgam of several cops.

“Because there wasn’t a name to associate, I didn’t have to look like them. We all sound alike, we all know what it’s like to grow up there, we all had parents who had to work extremely hard, and we were all faced with decisions to either go the right way or the wrong way in life,” says the actor, who has a well-documented checkered past.

Wahlberg says he focused on the “relentlessness” of Robert Merner, who became consumed with finding the bombers to the point of skipping sleep for several days. The actor also absorbed the cool-under-fire work of Detective Dan Keeler, who was at the finish line and kept his head during the chaos. He drew from a couple of other officers whose intimate knowledge of the neighborhood, including the areas covered by stores’ security cameras, proved crucial.

“It was pretty remarkable, getting into that head space. Then you look at some of the footage the news never aired — it’s enough to put you in that emotional head space. Some things you wish you never saw,” he says.

The filmmakers made sure to screen it for Bostonians first, including some who were directly affected by the bombing.

Wahlberg says, “I don’t want to say the name, but somebody who lost a loved one, they said, ‘This is never going to be a movie I’m going to like. You’ve re-created the worst day of my life. But you kept your word. You did what you said you were going to do. So thank you for that.’”