A reunion of sorts for Johnnie To, Wai Ka Fai and Lau Ching Wan, Mad Detective opens with a bang. Bun (played by Lau), a mentally unbalanced Hong Kong cop, takes a knife to a pig hanging from the ceiling of police headquarters. An associate then stuffs him inside a suitcase and throws him down several flights of stairs. Bun emerges bloody, but with the solution to a murder mystery. Later, at an office party, he hacks off his ear and presents it as a gift to an officer who is retiring.

Bun's trances, his ability to inhabit the minds of suspects to reenact crimes, and his tendency to speak to the inner devils of passersby, have proved too much for the police department and his wife, May (Kelly Lin), to deal with. He has been hiding in his apartment for five years when his former partner, Ho (Andy On), asks for help with the case of a cop who disappeared during a stakeout. Somebody has been using his gun in a series of increasingly violent crimes.

Clues point to the missing cop's corrupt partner, Chi-wai (Lam Ka Tung), but he has a seemingly airtight alibi. However, Bun can see that Chi-wai's destiny is controlled by seven separate devils, including a cowardly glutton (Lam Suet) and an icy killer (Jay Lau). The problem for Ho is that Bun sees devils everywhere and is too hot-headed to follow standard police procedures. Will tailing Chi-wai solve the case, or is it another insane delusion?

Mad Detective lacks the formal rigor of previous To films like Triad Election and Exiled, offering instead a freewheeling narrative that twists around its central themes with manic intensity. Key incidents are played out up to a half-dozen times, each version adding another layer of complexity to the characters and the story. Several films have toyed with the concepts of reality and fantasy, of sanity and madness; the directors here quote from A Beautiful Mind, for example. But few have tried to portray the world as shifting planes of existence in which identities can assume any shape. By the time Mad Detective reaches a hall-of-mirrors climax straight out of The Lady from Shanghai, the screen is overflowing with demons and alter egos.

The directors addressed similar themes in the romantic comedy My Left Eye Sees Ghosts, which also starred Lau; Mad Detective is not nearly as optimistic. Fans of To's recent solo work may be disappointed as well by the lack of prolonged action scenes. But the film does offer an expert character sketch of a gifted man slipping into insanity, as well as a puzzling, unpredictable story line that leads to a brilliant pay-off.

Typically for these directors the acting is first-rate, with Lam Ka Tung especially impressive as a cop who is a victim of his seedy appetites. And from the vibrato-laden score to the low-key cinematography and crisp editing, Mad Detective is as technically polished as any film you are likely to see this year.