An Innocent Man

James "Jimmie" Rainwood (Tom Selleck) is an ordinary and model citizen: happily married to his beautiful wife Kate (Laila Robins), has a modest home in Long Beach, California, works as an American Airlines engineer, drives a classic Pontiac Trans Am and pays his bills.
Detectives Mike Parnell (David Rasche) and Danny Scalise (Richard Young) are cops specializing in drug busts who also frame people and steal drugs that should be declared evidence so that they can use it for their own recreational drug use and selling to dealers.
One day Parnell takes a large hit of cocaine and becomes unable to concentrate properly about the address for the next drug bust expecting to find drugs. But instead they break into the wrong house as Jimmie walks out of the bathroom with a handheld hair dryer in hand, Parnell shoots thinking it's a weapon. Rainwood is shot in the shoulder and knocked unconscious. Realising that they could both be tested for taking drugs and charged they decide to cover up their mistake. They plant drugs in the house and place a firearm in the hand of Rainwood's unconscious body and they frame him as a drug dealer. Jimmie is pegged as a user having a prior record of marijuana possession while in college and his only defense is his word against two decorated cops. He claims the two cops framed him but no evidence proves the men are corrupt. He gets a 6-year prison sentence. Internal Affairs detective, John Fitzgerald (Badja Djola) takes a mild personal interest in the situation although he can not do anything since everything is hearsay.
Jimmie is initially naÃ¯ve about prison life; early in his term he sees his cellmate stabbed with a screwdriver and set on fire and then has a personal run in with the Black Guerrilla Family run by Jingles who took his commissary purchases. After the gang assaults him and threatens him with sexual assault, and does not report them, he comes to the realization that he has to take the recommendation of fellow inmates Butcher (Dennis Burkley) and Virgil Cane (F. Murray Abraham) to "take care of his problem."
Jimmie gets a plexiglas shank, stabs Jingles to death, and spends three months in a windowless, subterranean solitary confinement although it's never proven he did the job. When he is released to the general population he is received as a minor hero for ridding the prison of Jingles. On the outside, Kate is causing trouble by bringing the situation to the attention of whoever will listen and is threatened by Parnell and Scalise. Her visit to Fitzgerald went nowhere so she told him the detectives insulted him racially which although a lie was reinforced when Fitzgerald angrily told them to stay away from Kate and coincidentally use the words that Kate said they had used.
Before being paroled after three years served, Virgil suggests getting even with the detectives but he instead sets out to regain his life on the outside until paid a visit by the detectives who indicate that Jimmie's future depends on whether or not he does what Parnell and Scalise say.
Parnell and Scalise are set up to arrest the dealers of some "competition" that are in reality protected dealers of Joseph Donatelli (J.J. Johnston). Of course, the detectives do not turn over all the drugs and are robbed by masked culprits who unknown to them are Jimmie and Malcolm (M.C. Gainey) another inmate that later call in to the detectives to return the drugs for a cash payout where Malcolm is wired for sound recording by Fitzgerald. There is a glitch and Jimmie has to declare himself and a gun fight ensues, Malcolm is shot and killed by Parnell, Scalise dies after crashing his car trying to escape and Parnell is about to die at the hands of Jimmie by Parnell's own switchblade. Kate begs Jimmie not to kill Parnell saving him so that he can be convicted.
The movie ends with both Parnell and Jimmie returning to a life they both deserve. Parnell is put into general prison population (a creative liberty, as convicted ex-cops are always kept in protective custody or are housed in out of state Federal prisons[citation needed]). On entry to the prison inmate main room, Virgil calls attention to Parnel by yelling, "hey, officer" for all the other inmates to see and hear. Parnell looks up to the balcony where Virgil is standing, his face frozen in a mask of fear and hears Virgil say, "Ain't life a motherfucker?", repeating the line said when he and Jimmie met last and Jimmie went on parole. Jimmie is seen suited up working again for the airline thus finally getting his life back.

Question: Who are the detectives robbed by?
Answer: masked culprits