
17 Cal.2d 621 (1941)
THE PEOPLE, Respondent,
v.
RALPH GRIGGS, Appellant.
Crim. No. 4335. 
Supreme Court of California. In Bank.  
March 12, 1941.
 Raymond E. Hodge for Appellant. *622
 Earl Warren, Attorney-General, and Gilbert F. Nelson, Deputy Attorney- General, for Respondent.
 EDMONDS, J.
 The appellant, charged with murder, pleaded guilty but later moved the court for leave to withdraw that plea. This motion was denied and he was sentenced to death. The sole ground upon which he relies for a reversal of the judgment is that, under the particular circumstances shown, it was an abuse of discretion for the trial judge to deny his motion.
 The case is an unusual one. When the appellant was arrested he had the body of Gladys Long in his automobile. At that time she had been dead about ten days. He freely told the police officers that he had killed her and related the circumstances of the crime. Upon arraignment, he entered the pleas of not guilty and not guilty by reason of insanity. Later, upon the advice of his counsel, who had discussed the case with the District Attorney, by leave of court he withdrew those pleas and pleaded guilty to murder in the first degree. The appellant contends that this action was taken upon the assurance of the District Attorney that if he did so, a sentence of life imprisonment would be imposed; that there was no denial of the statements made by his counsel in open court; that the law seeks no unfair advantage over one charged with crime; and that, in the interests of justice, the court should have allowed him to withdraw a plea of guilty which was influenced by both hope and fear.
 Upon the issue as to the sentence which should be imposed, the District Attorney presented the facts pertaining to the commission of the crime as the appellant had given them to the officers. According to the appellant's statement, the crime occurred when he and Gladys Long, who had been living with him for some time, went on a trip and spent several days at a camp ground. One morning they arose early and began drinking. He stumbled against their tent and kicked some dirt into a frying pan. This angered the woman. He backed away trying to pacify her when she picked up a couple of rocks about as large as a fist and threw them at him. He then picked up a rough surfaced rock weighing about seven or eight pounds and threw it at her. He declares that as he threw it she was looking at him, but she turned her back to dodge and the rock struck her in *623 the back of the head, causing injuries which resulted in her death within a very few minutes. He then wrapped the body in the bed covering, put it in the rear compartment of his automobile, and drove back to Los Angeles. After his arrival there he continued his drinking and remained in an intoxicated condition until the odor from the body led to his arrest.
 The District Attorney stated that he could produce other evidence which he summarized as follows: When the appellant returned to Los Angeles he had all of the woman's belongings with him. These consisted of her clothing and $840 in money. An acquaintance told the appellant that he was in no condition to carry this money around with him. He thereupon gave it to her and she deposited it in a bank to her own credit. During the time he had the money in his possession, he told several persons that it represented the proceeds of ore obtained from a gold mine he owned in San Bernardino County.
 In concluding his presentation of the case the District Attorney said that the only information he had concerning the killing was obtained from the appellant. He added, "Everything we have at the autopsy and his condition while he was in Los Angeles is all consistent with his statement that he made in regard to this matter."
 Following some discussion as to the crime disclosed by this evidence, the trial judge announced that he felt it was his duty to impose the extreme penalty upon the appellant. His counsel then said: "May I make a statement before that? Several days ago Mr. Knauf approached me and gave me the substance of the testimony the state would present here, and he assured me at the time that if I could persuade the defendant to enter a plea of guilty in the first degree he was certain life imprisonment would be imposed. I talked with the defendant about the matter and he complied with my suggestion because of the assurances I had from Mr. Knauf. I also informed him I would take the matter up with his sister in Los Angeles and tell her what had been passed on to me. I did do that and I assured her the extreme penalty would not be imposed, and with that understanding the plea was entered this morning. It puts me in a position that if the Court feels the death penalty should be imposed I certainly would like to withdraw my plea of guilty of murder in the first degree." *624
 Later the appellant's counsel formally moved the court for permission to withdraw this plea of guilty for the purpose of reentering the plea of not guilty. In further support of his motion he stated: "I might say further, Your Honor please, that since talking with all his relatives with respect to the plea of not guilty by reason of insanity I find a great deal more evidence than I thought I would have or could have in support of that plea. I am convinced that this defendant is not mentally sound. I am convinced that he was not at the time this killing took place. I am convinced that I can produce considerable testimony as to his mental condition in addition to the fact that he is a chronic alcoholic."
 [1, 2] Prior to the judgment a court may at any time, in its discretion, permit a plea of guilty to be withdrawn and a plea of not guilty substituted. (Pen. Code, sec. 1018.) The discretion thus vested is one to be liberally exercised (People v. Miller, 114 Cal. 10 [45 P. 986]), and the determination of the trial court must be upheld unless abuse of discretion is clearly shown. (People v. Bostic, 167 Cal. 754 [141 P. 380].) But the ruling upon the appellant's motion, under the circumstances shown, cannot be justified. The District Attorney did not deny that he had made the representations stated by counsel for the appellant, and, unquestionably, the appellant pleaded guilty in reliance upon them. Of course, the District Attorney had no authority to make any agreement which would bind the court, but the law should be particularly considerate of one who, in good faith, has acted upon the inducement of a prosecuting officer and later seeks to stand upon his right to a trial, offering to produce substantial evidence in support of his innocence of the crime charged against him. These principles are particularly applicable in the present case.
 Although the appellant admits that Gladys Long met her death at his hands, there is considerable question concerning the crime which he committed. In the statement relied upon by the District Attorney the appellant stated that at the time of the quarrel both he and the woman were drunk although, he added, "I was able to see and talk and walk around." Other evidence before the court showed a record of inebriation extending over many years. As the District Attorney very fairly pointed out, the physicians appointed by the court reported that the appellant is a chronic alcoholic *625 who, at the time of their examination, was suffering from mental deterioration or mental aberration.
 [3] These facts are grounds for a defense against the charge of murder in the first degree and may also be properly urged in mitigation of punishment. For although drunkenness is no excuse for crime, when insanity is the result of long continued intoxication, it affects responsibility in the same way as insanity which has been produced by any other cause. (People v. Hower, 151 Cal. 638 [91 P. 507].) [4] Also, the fact of intoxication may be considered by the court or jury for the purpose of determining the purpose, motive or intent with which an act is done. (Pen. Code, sec. 22; People v. Burkhart, 211 Cal. 726 [297 P. 11]; People v. Murphy, 1 Cal.2d 37 [32 PaCal.2d 635].) This may be of particular importance where the degree of the crime committed depends upon the defendant's state of mind, as in a homicide case. (People v. Sutton, 17 Cal.App.2d 561 [62 PaCal.2d 397].)
 The judgment is reversed with directions to the trial court to grant the appellant's motion to withdraw his plea of guilty to the crime of murder in the first degree and thereafter to permit him to enter such plea or pleas as he may be advised.
 Shenk, J., Traynor, J., Curtis, J., Carter, J., and Gibson, C.J., concurred.
