Mark Wahlberg in Patriots Day.

The new collaboration between director Peter Berg and Mark Wahlberg, Patriots Day, is not only a valuable tribute to the victims and heroes of the Boston Marathon bombings; it’s a solid, meaningful, gritty look at what it took to take down the terrorist Tsarnaev brothers.

Wahlberg plays Sgt. Tommy Saunders, one of those fictional composite characters that often show up in historical dramas. You will forgive the two Bergs for this kind of artistic license, because the goal of Patriots Day is to take you through the entire drama, from the bombing itself, through the capture of Dzhokhar Tsarnaev (Alex Wolff) inside a boat in somebody’s backyard. There wasn’t a single person who was at all of the events leading up to the ultimate capture of the final living suspect in the bombings, so it’s best to just view the Wahlberg character as a representation of the heroism and diligence that led to that arrest.

The film begins with Saunders bitching about being on street-security detail for the Boston Marathon, as he serves out a probationary period on the Boston police force. He shows up in the “clown suit,” takes some ribbing from fellow cops and detectives, and generally sports a good attitude, doing the gig with an admirable level of conviction. The marathon itself gets his spirits up a bit—and then, as runners are crossing the finish line, the bombs go off.

The film doesn’t shy away from the carnage caused by those bombs—and it shouldn’t. It earns its R rating. The movie dives into the bombing aftermath, then straight into the investigation and tense standoffs that occurred in rapid succession.

Wahlberg has done some of his best work in Berg films (Deepwater Horizon and Lone Survivor), and this film represents the apex of their collaborations. True, the character he’s playing isn’t totally real, but it’s an honorable deviation.

Wolff is on target as the baseball-cap-wearing douche who doesn’t know how to say no to his brother. There’s nothing sympathetic about the portrayal of this certain brand of evil in this movie. He’s a cold-hearted, ignorant villain, and Wolff captures that essence. As Dzhokhar’s older brother and bombing mastermind, Tamerlan, Themo Melikidze delivers a chilling depiction of radicalism and psychotic egotism.

Michelle Monaghan is effective as Saunders’ wife, as are John Goodman as police Commissioner Ed Davis and Kevin Bacon as FBI Special Agent Richard DesLauriers. J.K. Simmons is hard-edged and a little bit funny as Sgt. Jeffrey Pugliese, who took part in the showdown that claimed the life of Tamerlan. Jimmy O. Yang is memorable as the man the brothers carjacked.

This is definitely one of 2016’s better ensemble casts. (While the film is getting a wide release now, it got a limited release last year to qualify for awards.) Berg, like Jeff Nichols (Midnight Special, Loving), had two good movies in 2016, with this and Deepwater Horizon. He’s no stranger to historical drama. Ever since Berg nearly derailed his promising directorial career with the abysmal Battleship, all of his big-screen films have been historical dramas: Lone Survivor, Deepwater Horizon and now Patriots Day, all Wahlberg collaborations, are based on real life events. Much to Berg’s credit, all of those events are represented with great detail, emotional honesty and integrity. They are also very entertaining. Right now, he’s kicking Steven Spielberg’s ass in the historical-drama department.

The film is about heroes—the heroes who worked to find the perpetrators, and the selfless, persevering heroes who were standing close to explosive devices when they went off. You’ll walk away from this movie thinking that Berg, Wahlberg and co. did all of these good people justice with Patriots Day. Most importantly, it’s a moving tribute to those who lost their lives.

Some might say “too soon” for the existence of a film such as this one. I say it’s never too soon to honor the good people of Boston and their ability to recover from such a horrific day.

Patriots Day opens Friday, Jan. 13, at theaters across the valley.