The year is 1988, and the mutilated body of a 20-year-old woman is found in a flat in Cardiff. Four witnesses come forward to say they saw a pale, brown-haired man with a bloodied hand, outside, soon after the murder, crying and muttering incoherently to himself. After a 10-month investigation the police arrest and charge five black and mixed-race men, all of whom have alibis. A Killing in Tiger Bay (BBC Two) tells the story – in three hour-long episodes and granular, unsensationlist detail – of what happened, along with the subsequent convictions of three of them and the international outcry that saw those convictions eventually overturned.

As with most miscarriages of justice, the case is both unbelievable and only too believable. Unbelievable because, well, see above. And only too believable because of the way we know systemic bias and individual prejudice work and how they produce results that have a perverted logic of their own.

The documentary delicately traces all the strands that produced such injustice for Stephen Miller, John and Ronnie Actie, Tony Paris and Yousef Abdullahi – and, of course, until her true murderer was identified and convicted years later, Lynette White.

There are interviews with surviving members of “the Cardiff five” – Miller, Paris and John Actie – and their lawyers, as well as people living in the Tiger Bay area at the time of White’s death who remember her and the disbelief that flooded the community. We also hear from men who worked as junior police officers on the case (we are told that all senior officers who were involved declined to take part in the programme), with contemporary news footage and extracts from the taped police interviews weaved in besides. The documentary does a masterly job of unpacking the story, and the influences at play, sketching individual backgrounds and setting the whole in its wider sociocultural context.

We learn about White from those who knew her. They remember her, and the troubles at home that led her to working on the streets at the age of 16. Gaynor Legall, a local resident, remembered her “bright-eyed, open face”. “The sex work scene in the 80s – it was sad sometimes,” says Lynette’s childhood friend Paula Hill. “It was cold. Clients, punters – whatever you want to call them – they were dangerous.” The police, adds local solicitor Marilyn Bishop, who would end up representing Paris, “never had much sympathy”.

Actie, Paris and others paint a vivid picture of Tiger Bay – among Britain’s oldest multicultural communities – as an impoverished but close-knit and happy place, despite the reputation for trouble it had among outsiders. It was also a place where, according to Legall, “you could still be picked up off the street and given a hiding by two or three police officers and then charged with assaulting them”. This is set against a comment from one of the junior officers, who says that the Bay had become “a bit of a no-go area at night. It took some strong policing.”

Vulnerability breeds vulnerability, mistrust breeds mistrust, injustice breeds injustice. When, under increasing pressure to make an arrest, changes are made to the investigative team, its new leaders start bringing in the men of Tiger Bay for questioning. One of the junior officers explains that in those days it was commonplace to arrest a suspect first on a colleague’s hunch (“And 90% of the time it was probably right”) and then build the case thereafter.

The interview tapes of the five men the police choose to focus on are astounding. “Building the case” here seems to comprise little more than the officers hammering away at the men with their alternative version of reality – based on unlikely sounding accounts from two of White’s friends who had previously and repeatedly denied any knowledge of her murder – until one of them broke. Miller says that they would get the chance to sort it all out in court.

The current fashion for true crime and miscarriage of justice documentaries has led to an increasing drop-off in quality, with more and more superficial, voyeuristic and exploitative entrants in the field. But A Killing in Tiger Bay reminds us what they can and should be – a means of remembering victims, giving voice to the voiceless, and a rigorous examination not just of what, but of how and why awful things occur. They can also offer the possibility of change, although, in this case, it is of course too late for many erstwhile residents of Tiger Bay.