The Kingdom

“The Kingdom” offers the satisfaction of a crowd-pleasing police procedural — the mystery is solved; the bad guys are caught — tempered with the uneasiness of a terrorism thriller. It suggests that evil-doers can be tracked down and punished, which is comforting. But it also suggests that if both sides are convinced they’re right and are willing to die to prove it, the battle might never end.

It begins with a devastating attack on a housing compound in Riyadh, Saudi Arabia, where American oil company employees and their families live. The Saudi government, after initially insisting that U.S. investigators stay out to avoid looking weak before the Saudi people, grudgingly allows a small team of FBI personnel into Riyadh, just for a few days, and only if they promise to follow instructions.

The team is led by Ronald Fluery (Jamie Foxx), a seasoned FBI commander and “CSI”-worthy detective, with medical doctor Janet Mayes (Jennifer Garner) and investigators Adam Leavitt (Jason Bateman) and Grant Sykes (Chris Cooper) rounding out the squad. Their Saudi contact is Col. Al-Ghazi (Ashraf Barhom), a military officer who is disgruntled at being saddled with babysitting the FBI. He’s more than happy to follow his orders, which are to prevent the FBI from actually doing anything.

His reluctance wears off, of course, and Al-Ghazi and Fluery establish a sort of friendship based on mutual respect as the investigation goes forward. Al-Ghazi is a good man and an observant Muslim who cares for his aging father and genuinely wants to root out the terrorists who have blemished his country’s (and his religion’s) reputation. His and Fluery’s relationship borders on being a buddy-cop odd-couple scenario, though fortunately it never quite succumbs to that cliche.

The prime suspect in the attack is Abu Hamza, an “Osama wannabe” whose whereabouts are difficult to ascertain but whose followers are numerous and devoted. After some clever clue-finding on the part of the Feds (marbles are a factor), the film shifts into its more suspenseful act, in which militants work to kill the FBI crew if possible, or to thwart their investigation at the least.

This is director Peter Berg’s fourth film, following “Very Bad Things,” the surprisingly entertaining “The Rundown,” and the mature sports drama “Friday Night Lights,” and he continues to defy expectations. “The Kingdom” is packed with information and characters, and features the you-are-there handheld camerawork that can be unnerving when it’s overused. It’s a smart film with deep themes. Yet Berg allows it to work as entertainment, too. Matthew Michael Carnahan’s script finds places for the lead actors to occasionally do what they’re best-known for, whether it’s Jamie Foxx cracking a joke, Jason Bateman being dryly sarcastic, or Chris Cooper giving someone a withering look that indicates he is not interested in any nonsense.

The entire film is effortlessly compelling, with a natural mix of lighter moments, white-knuckle tension, and crime-solving nitty-gritty, but it’s bookended by two unforgettable scenes. At the beginning is perhaps the most educational opening credit sequence I’ve ever seen, with swift graphics summarizing the last century of U.S.-Saudi relations. It’s not absolutely vital to know all of that before you watch the film, but it certainly enhances the experience.

And at the end of the film is an emotional, haunting denouement that resolves an earlier thread while perfectly encapsulating the film’s message. The last line of dialogue in a movie is almost never very important, so you notice it all the more when it is. This one stayed with me for days. So did the rest of the movie.

B+ (1 hr., 50 min.; R, a fair amount of harsh profanity and very strong violence, some of which is rather brutal.)