You cannot use force, even reasonable force, to resist an unlawful detention or arrest.  An unlawful arrest or detention by a police officer does not give license to an individual to strike or assault the officer.  However, if the officer is using excessive force against you or threatens to use excessive force against you, then you do have the right to resist in self-defense.