80s Asian Thriller/Drama - Undercover Cop - Tragic Ending

A young undercover cop infiltrates a brutal street gang. Only his superior knows about it.
At the end of the film, the gang is caught in a major police operation. Meanwhile, to avoid arrest, the undercover cop hides in the stairwell of an apartment building.
Unfortunately, the residents recognize him as one of the gang members.
Not suspecting his true identity, they chase him to the exit, which is unfortunately locked with a lattice door. His supervisor can’t stop the angry mob in time and has to watch his young colleague bleed to death. He holds his hand while crying for help.

I finally found the Movie!
The ending is a bit different than I described, but hey, it’s been a while. :wink:

English title: Man on the brink
Original titel: Bin yuen yan
Hong Kong 1981

[Ending scene] (Man on the Brink - YouTube)