The prophet told the story to the king of Israel to deceive him, so the king would make a ruling which would result in the forfeit of the king's own life.