It is lawful for a person who is charged by law with the duty of executing a lawful warrant issued by any court or justice or other person having jurisdiction to issue it, and who is required to arrest or detain another person under such warrant, and for every person lawfully assisting a person so charged, to arrest or detain that other person according to the directions of the warrant.