A convicted drug dealer has been released from jail as a consequence of the police staging a fake prosecution of an undercover officer.

Trevor John Momo Wilson has been freed on bail despite pleading guilty to supplying LSD, cannabis, and party pills.

He pleaded guilty following Operation Explorer, which planted an undercover officer in the Nelson-based Red Devils gang.

There were 20 other co-accused but Wilson was the only one to plead guilty.

Justice Simon France threw out the prosecutions of the 20 accused in October after it was revealed police had perpetrated a "fraud" on the courts by staging the fake prosecution and forging a search warrant they served on a member of the public.

Wilson had already begun his sentence but appealed his conviction after the other prosecutions were stayed.

"The grounds of his appeal are that a miscarriage of justice will otherwise occur if he is to continue serving a prison sentence while the other co-accused, many of whom are accused of having committed more serious offences, walk free," Appeal Court Justice Christine French said in her decision released today.

Wilson's appeal has not been given a date yet but he applied for bail in the mean-time.

They also submitted that even if they were unable to overturn Justice France's stay decision, Wilson's appeal would still not succeed because he had accepted his guilt.

Justice French disagreed.

"I accept that it is only in exceptional circumstances that this Court will entertain an appeal against conviction following a guilty plea.

"However... it is in my assessment more than arguable that should Simon France J's stay decision be upheld on appeal, it would be a miscarriage of justice for the appellant to be denied the benefit of that decision."

Justice French said that Wilson's appeal had merit and as the hearing date would probably be some way off it was "in the interests of justice that the appellant should be on bail".

Wilson was released on the same bail conditions he had before going to prison.