Infernal Affairs III

Infernal Affairs III uses parallel storytelling, flashing between the past and the present.
Six months before Chan's death[edit]
Undercover cop Chan Wing-yan seeks to uncover the link between Hong Kong triad boss Hon Sam and the mysterious Chinese gang leader Shen Cheng. Since Hon's ascension to the seat of triad boss was due to the death of his predecessor, Ngai Wing-hau, Hon is suspicious of all his men for fear they might usurp his position. He tests Chan's loyalty by ordering him to smash an ashtray on Shen's brother during a negotiation, resulting in Chan's arrest by Inspector Yeung Kam-wing. Yeung tells Chan that though Chan does not recognise him, he recognises Chan and he warns the latter to "be careful". Chan is released after both Hon and Shen fetch him at police headquarters.
Concurrently, Chan is prosecuted for violent behaviour. His superior, Superintendent Wong Chi-shing, persuades the court to allow Chan to seek therapy, leading him to meet Dr. Lee Sum-yee. Hon asks Chan to deliver arms to Shen, but he and other triad members do not show up. When Chan delivers the cargo, Shen's men discover that the boxes are empty and open fire on Chan; Shen and Chan shoot each other in the limbs during the crossfire. Shen finds out that Chan is an undercover cop when Yeung unexpectedly arrives on the scene. Yeung tells Chan that Shen is also an undercover cop, working for Chinese authorities. Yeung also tells Chan that he gained top honours when he was in the police academy due to Chan's "expulsion". The three shake hands and wait for the chaos to subside before leaving.
Ten months after Chan's death[edit]
Lau Kin-ming (Andy Lau), Hon's former mole in the Hong Kong Police Force, has been demoted to administrative duty pending an investigation into the deaths of Chan and Inspector B. He falsely claims that B shot Chan in the head while holding him hostage, and that he killed B in retaliation. After months of investigation, Lau is transferred back to Internal Affairs, where he struggles to whitewash his past and cover his true identity. Lau later learns that Hon had previously planted five other moles in the police force, one of whom might be a fellow Security Division Inspector, Yeung. A battle of wits develops between Lau and Yeung, as each of them tries to discover the other's secret.
Meanwhile, Lau suffers from an identity collapse as he loses track of reality, wrestling with guilt over Chan's death and grappling with his impending divorce from his wife, Mary. His psychological trauma deteriorates to the point where he begins to see himself as Chan. As "Chan", Lau makes it a personal mission to apprehend Yeung, whom he sees as his former self. After witnessing an incident where Lau suffers a hallucination, Dr. Lee conducts a hypnosis on him and finds out that he was Hon's mole. Lau realises his folly and knocks Lee unconscious before escaping.
Lau steals tapes from Yeung's office safe, using spy cameras to determine the code. He thinks he hears recordings of Yeung relating information to Hon, and leads his team to the Security Division to arrest Yeung just as Shen arrives. Lau plays a tape recording, which is actually the conversation between him and Hon. When Lau's second-in-command tries to arrest him instead, Lau panics and draws his gun, killing Yeung. He is immediately shot by Shen and attempts suicide by shooting himself in the neck. During a search of Lau's office, a tape is found in his safe and played. It is a recording of the song sung by Tsai Chin, given to him by Hon's wife.
Eleven months after Chan's death[edit]
A series of flashbacks play: immediately after Chan's death, Shen and Yeung meet. Shen suspects Lau. Yeung breaks into Lau's office to find tape recordings of his conversations with Hon, proving that Shen is right.
Yeung is buried next to Chan in the police cemetery. Shen and Lee visit the graves and Shen says to Lee: "Events change men, but men do not change events. But these two men are extraordinary because they changed events."
Lau ends up crippled and catatonic, lost inside his own mind, haunted by the spirit of Mary (Hon Sam's wife, whom he had a crush on in Infernal Affairs II) and locked in his own "continuous hell". His divorced wife Mary visits and tells him, "Our baby can say "papa" now." Before the picture fades into the next scene, the camera pans down onto Lau's fingers tapping out in Morse code, "H-E-L..." (and then the start of another 'L' as the picture dims).
Before the film ends, there is one final flashback to the hi-fi shop scene in Infernal Affairs, where Lau is buying an audio system from Chan.

Question: Who is prosecuted for violent behavior?
Answer: Chan