The best analysis of it I have seen is by Imam Abu Hamid Ghazali, who says: "Speak- ing is a means to achieve objectives. If a praiseworthy aim is attainable through both telling the truth and lying, it is unlawful to accomplish through lying because there is no need for it. When it is possible to achieve such an aim by lying but not by telling the truth, it is permissible to lie if attaining the goal is permissible (N: i.e. when the purpose of lying is to circumvent some- one who is preventing one from doing something permissible), and obligatory to lie if the goal is obligatory."