
922 P.2d 383 (1996)
129 Idaho 86
STATE of Idaho, Plaintiff-Respondent,
v.
Chuck HARPER, Defendant-Appellant.
Nos. 21652, 21653.
Supreme Court of Idaho, Coeur d'Alene, May 1996 Term.
July 30, 1996.
Clayton G. Andersen, Coeur d'Alene, for appellant.
Alan G. Lance, Attorney General; John C. McKinney, Deputy Attorney General, Boise, for respondent. John C. McKinney argued.
SCHROEDER, Justice.
Chuck Franklin Harper (Harper) appeals the district court's: (1) denial of his motion to withdraw his guilty pleas; (2) denial of his request for a separate competency hearing pursuant to section 18-212 of the Idaho Code; and (3) failure to order a separate evaluation of his mental condition pursuant to sections 19-2522 and 19-2523 of the Idaho Code prior to sentencing.

I.

BACKGROUND AND PRIOR PROCEEDINGS
Harper was charged with possession of a controlled substance with the intent to deliver *384 (methamphetamine) and possession of a controlled substance (LSD). In a separate case he was charged with attempted first degree murder and unlawfully discharging a firearm at a dwelling house.
Counsel for Harper filed a motion in the attempted murder case for a mental examination to determine Harper's fitness to proceed to trial, pursuant to sections 18-210[1] and 18-211[2] of the Idaho Code. The court granted the motion and directed Dr. Marie Parkman to prepare a report including:
a. a description of the nature of the examination;
b. a diagnosis, evaluation, or prognosis of Harper's mental or emotional condition;
c. an analysis of the degree of any illness or defect and level of functional impairment;
d. an opinion as to whether Harper is capable of understanding the nature and object of the proceedings against him and whether he is able to consult with counsel with a reasonable degree of rational understanding; and
e. a consideration of the risk of danger which Harper may create for the public if at large.
Subsequently, the district court granted Harper's motion to amend the order to include a directive to Dr. Parkman to form an opinion as to Harper's ability to form the requisite mens rea for the charged offenses. Dr. Parkman found Harper competent to stand trial.
On the day scheduled for pretrial conference counsel for Harper filed a motion requesting a hearing pursuant to section 18-212[3] of the Idaho Code to contest Dr. Parkman's findings. Following a break in the pretrial conference, counsel for Harper announced that an agreement had been reached that would dispose of the charges in both pending cases. Despite the plea agreement, the attorneys and the district judge stated their understanding that Harper's motion to contest Dr. Parkman's findings was unresolved. Harper then entered guilty pleas to attempted voluntary manslaughter and unlawful discharge of a firearm at a dwelling house. The district court recognized the guilty pleas as Alford pleas. Harper pled guilty to possession of methamphetamine *385 several days later. The possession of LSD charge was dismissed.
Subsequently, counsel for Harper filed motions in both cases to set aside Harper's guilty pleas and a motion for a hearing pursuant to section 18-212 to contest the competency findings as previously requested. The motion declared that a hearing on the motions would be held on June 2, 1994, the original date set for sentencing.
A hearing was held on June 2nd. The court asked Harper's counsel if he was prepared to argue his motion for a section 18-212 hearing to which Harper's attorney replied in the affirmative. An element of confusion exists as to whether the district court intended to hear only the question of whether a hearing should be held or intended to hear the merits of the motion contesting the finding of competence. Evidence concerning Harper's competency was presented by the State and on behalf of Harper on the question of whether Harper should be allowed to withdraw his guilty pleas. The State's evidence that Harper was competent was contradicted by Dr. Karen Sheppard who concluded that Harper did not have the ability to assist in his defense because he had difficulty remembering information and had a tendency to "confabulate." Dr. Sheppard also concluded that Harper was incapable of forming the requisite mens rea for the offenses charged, that he posed a substantial risk of harm to others, that he was not susceptible to medicinal treatment, and that he should be committed to a state hospital.
Harper's counsel requested that a separate hearing be set under section 18-212 to determine Harper's competency. The district court took the matter under advisement and later issued a written opinion denying the motion to set aside Harper's guilty pleas to attempted voluntary manslaughter and discharging a firearm at a dwelling house. In addition to denying Harper's motion to withdraw his guilty pleas the court found that, since the court heard relevant testimony regarding Harper's competency, the June 2nd hearing was the functional equivalent of a competency hearing. The district court rejected Dr. Sheppard's conclusions in favor of Dr. Parkman's and the court's own observations of Harper. Consequently, the court denied Harper's motion for a separate hearing pursuant to section 18-212.
The district court made findings that Harper's mental condition was a significant factor for the purpose of sentencing pursuant to section 19-2523 of the Idaho Code.[4] In doing so the court considered: (1) reports from Dr. Parkman, Dr. Michael Urban, and Dr. Karen Sheppard; (2) testimony of Drs. Parkman and Sheppard presented June 2, 1994; (3) Kootenai Medical Center admissions records for November 13, 1993, and February 18, 1994; and (4) testimony of witnesses at the sentencing hearing. The district court noted *386 that Harper had refused a request from the presentence investigator to get psychological/psychiatric records from Washington state where Harper had served time for armed robbery and second degree burglary. The district court also noted that Harper had declined to provide the court with any records from Dr. John Gordon or Pinecrest Psychiatric Hospital. The court then concluded that: (1) Dr. Parkman's report was sufficient for the purposes of sections 19-2522[5] and 19-2523 of the Idaho Code; (2) Dr. Parkman's conclusions were corroborated by the Kootenai Medical Center records; and (3) the reports of Drs. Urban and Sheppard did not refute Dr. Parkman's conclusions. The district court concluded that Harper's mood disorder was secondary to methamphetamine abuse, an anti-social personality disorder, and an attention deficit disorder. The district court also concluded that Harper's mental condition had not impaired his ability to form criminal intent, but rather impaired his impulse control in conflict situations. The district court ordered treatment of Harper's mental condition during his confinement, pursuant to section 19-2523.
The district court sentenced Harper to the custody of the Idaho State Board of Correction for not less than five nor more than seven years for the charge of attempted voluntary manslaughter and imposed a concurrent sentence of not less than two years nor more than four years for the charge of discharging a firearm at a dwelling house. The district court sentenced Harper to not less than one year nor more than three years for possession of a controlled substance (methamphetamine), which is to be served consecutive to that served for the attempted voluntary manslaughter and firearms convictions.

II.

STANDARD OF REVIEW
The standard of review concerning whether the district court should have allowed the withdrawal of the guilty pleas is whether the district court abused its discretion. State v. Carrasco, 117 Idaho 295, 298, 787 P.2d 281, 284 (1990). A trial court's discretion in ruling on a motion to withdraw a plea should be liberally exercised. Id. In determining whether to grant a motion to withdraw a guilty plea, the trial court is only required to consider whether: (1) the plea was voluntary in the sense that the defendant understood the nature of the charges and was not coerced; (2) the defendant knowingly and intelligently waived his right to a jury trial, to confront accusers, and to refrain from incriminating himself; and (3) the defendant understood the consequences of pleading guilty. State v. Mauro, 121 Idaho 178, 180, 824 P.2d 109, 111 (1991). If the issue of competency is raised, the court's own observations and impressions are relevant to a determination of competency. I.C. § 18-212(1); see also State v. Fuchs, 100 Idaho 341, 347, 597 P.2d 227, 233 (1979) (defendant's demeanor during court proceedings and responses to trial judge's questions may *387 raise issue of competency sua sponte); State v. Potter, 109 Idaho 967, 969, 712 P.2d 668, 670 (Ct.App.1985) (A trial judge is under a continuing duty to observe a defendant's ability to understand the proceedings against him.); State v. Curtis, 103 Idaho 557, 560-61, 650 P.2d 699, 702-03 (Ct.App.1982) (trial court's observations of defendant's demeanor and responses to questions regarding the significance and effect of the criminal proceedings are relevant to court's determination of defendant's competency).

III.

THE DISTRICT COURT DID NOT ABUSE ITS DISCRETION BY DENYING HARPER'S MOTION TO WITHDRAW HIS GUILTY PLEAS.
The key issues presented by Harper's challenge to the district court's denial of the motion to withdraw guilty pleas are: (1) whether the court abused its discretion by declining to commit Harper for an in-depth long term inpatient evaluation when the two outpatient examiners disagreed as to Harper's competency; and (2) whether the court abused its discretion by denying Harper the opportunity to argue the issue of criminal intent to a jury by refusing to allow withdrawal of the pleas.
The record does not reveal what, if any, specific consideration the court gave to Dr. Parkman's testimony regarding the general protocol for an inpatient evaluation that is followed when two examiners disagree as to a diagnosis. The district judge resolved the dispute based on the evidence presented and his own observations, determining that Harper was competent. The court did not reexamine Harper at the June 2nd hearing, but the district judge had questioned Harper at length at the time he entered his plea in the attempted voluntary manslaughter case. At that time Harper testified that he intended to shoot at William Stewart and at the Stewart dwelling in the belief that he was acting in self-defense.
The district judge had the testimony of a qualified expert whom he believed and the benefit of his own observations of Harper. The district judge was adequately informed as to Harper's competency. Under these circumstances it was not necessary to order an inpatient evaluation. The district court did not abuse its discretion in denying the motion to withdraw the guilty pleas.

IV.

THE TRIAL COURT DID NOT ABUSE ITS DISCRETION BY DENYING HARPER'S MOTION FOR A SEPARATE HEARING PURSUANT TO SECTION 18-212 OF THE IDAHO CODE.
On May 23, 1994, counsel for Harper filed motions to set aside Harper's guilty pleas and for a hearing as previously requested under section 18-212. A hearing was conducted by the district court on the motion to set aside the plea on June 2, 1994. There was some confusion as to whether the hearing would encompass the section 18-212 hearing or whether the hearing was simply to determine if a hearing should be set. The motion to set aside the plea of guilty and the motion for hearing under section 18-212 dealt with the same subject matterthe competence of Harper.
The court proceeded with the hearing, and both parties offered evidence concerning Harper's competence. The district court ultimately concluded that Harper had the capacity to understand the proceedings against him and assist in his own defense. Consequently, the court denied the motion to withdraw the pleas of guilty. The district court then made the following determination regarding the section 18-212 competency hearing:
Where the issue of Defendant's fitness to proceed has been raised, the trial court should conduct a hearing to determine Defendant's capacity before accepting a guilty plea. State v. Fuchs, 100 Idaho 341, 597 P.2d 227 (1979). Such a hearing need not be designated formally as a competency hearing, however. So long as the Court hears relevant testimony regarding Defendant's competency, such a hearing may be the "functional equivalent" of a competency hearing. State v. Curtis, 103 Idaho 557, 650 P.2d 699 (1982) (sentencing proceeding *388 was functional equivalent of competency hearing).[6]
The Court concludes that a functional equivalent of a competency hearing was held on June 2, 1994, when the Court heard expert testimony concerning Defendant's competency, since the issue at the hearing on withdrawal of Defendant's guilty plea was Defendant's competency. As set forth above, the Court determined that Defendant is competent to enter a guilty plea. Defendant's request for another hearing for determination of competency is denied.
The issue of competency was fully litigated. There is no showing of other evidence that would have been introduced on this subject had still another hearing been held. The district court did not abuse its discretion by denying the motion for a separate hearing pursuant to section 18-212 of the Idaho Code.

V.

THE DISTRICT COURT DID NOT ABUSE ITS DISCRETION BY FAILING TO ORDER A SEPARATE EVALUATION OF HARPER PURSUANT TO SECTIONS 19-2522 AND 19-2523 OF THE IDAHO CODE PRIOR TO SENTENCING.
Idaho Code sections 19-2522 and 19-2523 set forth the procedure to be followed and factors to be considered by the district court when there is reason to believe that the mental condition of the defendant will be a significant factor at sentencing. The district court's order for examination did not address two of the criteria under subsection (3) of section 19-2522: (d) a consideration of whether treatment is available for the defendant's mental condition; and (e) an analysis of the relative risks and benefits of treatment or nontreatment. Despite the omission of these factors from the order of examination, the information required by Idaho Code section 19-2522(3)(d)-(e) was provided to the district court and was considered prior to Harper's sentencing. Dr. Parkman testified that Harper posed a risk to society if his drug abuse continued and disagreed with Dr. Sheppard as to Harper's potential for responding to medication. Dr. Sheppard testified that Harper should undergo a PET examination; that he needed supervision and treatment; that he presented a substantial risk of harm to others and should be committed to a maximum security treatment facility; and that his frontal lobe disfunction could not be cured by medication or treatment. Regardless of the omission of the criteria in the order, the pertinent information was submitted to the district court and considered by that court.
The rule of harmless error establishes that any error, defect, irregularity or variance cited on appeal which does not affect substantial rights shall be disregarded. I.C.R. 52; State v. Zimmerman, 121 Idaho 971, 976, 829 P.2d 861, 866 (1992). Harper has not demonstrated prejudice, because he received the recommendation he requested. The purpose of the psychological report outlined in section 19-2522 is to assist the district court at sentencing in determining whether to recommend psychological treatment under section 19-2523 during a defendant's confinement or probation. Harper requested that the court recommend that he receive further evaluation and treatment at the psychiatric unit of the state penitentiary. The court recommend such treatment. There was no prejudice to the defendant by any omission in the order for examination.

VI.

CONCLUSION
The district court's decisions denying the motion to withdraw guilty pleas, denying the request for a separate competency hearing, and the decision that there was no prejudice to Harper by failure to order a separate evaluation of his mental condition are affirmed.
McDEVITT, C.J., and JOHNSON, TROUT and SILAK, JJ., concur.
NOTES
[1]  18-210. Lack of capacity to understand proceedingsDelay of trial.No person who as a result of mental disease or defect lacks capacity to understand the proceedings against him or to assist in his own defense shall be tried, convicted, sentenced or punished for the commission of an offense so long as such incapacity endures. I.C. § 18-210 (1987).
[2]  Section 18-211 states, in relevant part: (1) Whenever there is reason to doubt the defendant's fitness to proceed as set forth in section 18-210, Idaho Code, the court shall appoint at least one (1) qualified psychiatrist or licensed psychologist or shall request the director of the department of health and welfare to designate at least one (1) qualified psychiatrist or licensed psychologist to examine and report upon the mental condition of the defendant to assist counsel with defense or understand the proceedings. The costs of examination shall be paid by the defendant if he is financially able. The determination of ability to pay shall be made in accordance with chapter 8, title 19, Idaho Code.

....
(5) Upon completion of the examination a report shall be submitted to the court and shall include the following:
(a) a description of the nature of the examination;
(b) a diagnosis or evaluation of the mental condition of the defendant;
(c) an opinion as to the defendant's capacity to understand the proceedings against him and to assist in his own defense;
(d) when directed by the court, an opinion as to the capacity of the defendant to form mens rea or a particular state of mind which is an element of the offense charge.
....
I.C. § 18-211 (1987).
[3]  Section 18-212 states, in relevant part: (1) When the defendant's fitness to proceed is drawn in question, the issue shall be determined by the court. If neither the prosecuting attorney nor counsel for the defendant contests the finding of the report filed pursuant to section 18-211, Idaho Code, the court may make the determination on the basis of such report. If the finding is contested, the court shall hold a hearing on the issue. If the report is received in evidence upon such hearing, the party who contests the finding thereof shall have the right to summon and to cross-examine the psychiatrist or licensed psychologist who submitted the report and to offer evidence upon the issue.

I.C. § 18-212(1) (1987).
[4]  19-2523. Consideration of mental illness in sentencing.(1) Evidence of mental condition shall be received, if offered, at the time of sentencing of any person convicted of a crime. In determining the sentence to be imposed in addition to other criteria provided by law, if the defendant's mental condition is a significant factor, the court shall consider such factors as:

(a) The extent to which the defendant is mentally ill;
(b) The degree of illness or defect and level of functional impairment;
(c) The prognosis for improvement or rehabilitation;
(d) The availability of treatment and level of care required;
(e) Any risk of danger which the defendant may create for the public, if at large, or the absence of such risk;
(f) The capacity of the defendant to appreciate the wrongfulness of his conduct or to conform his conduct to the requirements of law at the time of the offense charged.
(2) The court shall authorize treatment during the period of confinement or probation specified in the sentence if, after the sentencing hearing, it concludes by clear and convincing evidence that:
(a) The defendant suffers from a severe and reliably diagnosable mental illness or defect resulting in the defendant's inability to appreciate the wrongfulness of his conduct or to conform his conduct to the requirements of law;
(b) Without treatment, the immediate prognosis is for major distress resulting in serious mental or physical deterioration of the defendant;
(c) Treatment is available for such illness or defect;
(d) The relative risks and benefits of treatment or nontreatment are such that a reasonable person would consent to treatment. (of the offense charged.)
(3) In addition to the authorization of treatment, the court shall pronounce sentence as provided by law.
[5]  19-2522. Examination of defendant for evidence of mental conditionAppointment of psychiatrists or licensed psychologistsHospitalizationReports.(1) If there is reason to believe the mental condition of the defendant will be a significant factor at sentencing and for good cause shown, the court shall appoint at least one (1) psychiatrist or licensed psychologist to examine and report upon the mental condition of the defendant. The costs of examination shall be paid by the defendant if he is financially able. The determination of ability to pay shall be made in accordance with chapter 8, title 19, Idaho Code. The order appointing or requesting the designation of a psychiatrist or licensed psychologist shall specify the issues to be resolved for which the examiner is appointed or designated.

(2) In making such examination, any method may be employed which is accepted by the examiner's profession for the examination of those alleged to be suffering from a mental illness or defect.
(3) The report of the examination shall include the following:
(a) A description of the nature of the examination;
(b) A diagnosis, evaluation or prognosis of the mental condition of the defendant;
(c) An analysis of the degree of the defendant's illness or defect and level of functional impairment;
(d) A consideration of whether treatment is available for the defendant's mental condition;
(e) An analysis of the relative risk and benefits of treatment or nontreatment;
(f) A consideration of the risk of danger which the defendant may create for the public if at large.
[6]  The proper citation for this case is State v. Curtis, 103 Idaho 557, 650 P.2d 699 (Ct.App. 1982).
