A man who has been likened to a "zombie" managed to strip a policeman of his gun, calmly withstand capsicum spray and ward off the attempts of two officers to subdue him for five minutes before they allowed him to escape, a court has heard.

The plainclothes police officers allegedly attempted to arrest William Murray for being in breach of his bail conditions in Redfern in January last year, but were left physically exhausted by the struggle, which was watched by local residents who ignored their calls for help.

Murray has been charged with assaulting a police officer in the execution of their duty, resisting arrest, using an offensive weapon to prevent lawful detention and escaping police custody.