Section 220(5)(a) in The Code of Criminal Procedure, 1973
(a)A rescues B, a person in lawful custody, and in so doing cause grievous hurt to C, a constable in whose custody B was. A may be charged with and convicted of, offences under Sections 225 and 333 of the Indian Penal Code (45 of 1860).