Pope Francis has told soldiers, police and other law enforcement officials from around the world that armed force can only be used for legitimate defense and must always respect international law.