The Town is good enough to make you forget what a conventional cops and robbers story it is. Ben Affleck, directing, co-writing and starring, strikes a balance between action/suspense and character moments, even throwing in some lyrical details, like a shared moment between a small boy and a bank robber in a nun mask.

That’s right, we’re in Charlestown Boston, the bank robbery capital of America, as the billboards say. Ben Affleck plays Doug, the leader of a gang of crooks, who falls in love with a bank teller (Rebecca Hall) in the middle of knocking over a bank. Since he was wearing a mask, she doesn’t realize it’s him when they meet cute, and inevitably there will a moment where she, still suffering post-traumatically, learns this man she’s falling for is a villain.

Meanwhile, an FBI agent (Jon Hamm, living up to his last name here) is on the trail of this syndicate. He’s tenacious, but his character is otherwise undeveloped. Clearly, we’re supposed to be rooting for the gangsters here.

The Town is reminiscent of the great Warner Bros. gangster films. Jeremy Renner, as the hot-headed thug James, has been getting a lot of attention for his performance. It is compelling, and fits squarely in the James Cagney/Joe Pesci mold. If there’s anything that sets The Town apart from other gangster films, it is the moral universe it inhabits. Its code of justice is the law of the streets.

I recommend the film highly, but let me enumerate some flaws. You will know from the moment that Jon Hamm’s FBI agent character receives a cell phone call inside the Faraday’s cage of a bank vault that this film is going to be a cartoon of reality. Three cop cars crashing? No, better make it five. The script, while generally excellent, gets overly-writerly in a few places, by which I mean the characters start speaking in the voice of the screenwriter and not their own, an example of which is Affleck’s monologue in the garden. I already mentioned the one-dimensionality of Hamm’s agent, but Rebecca Hall’s Claire is not given much depth either.

In a world where The Departed did not exist, The Town would probably be hailed as an instant classic of the genre. But living as it does in the shadow of that great Boston crime film, it will have to content itself to be hailed as Ben Affleck’s comeback film.