Appellant, Lester H. Banks, M.D., appeals from a judgment of the Circuit Court for Carroll County, sitting as an appellate *252court, affirming the decision of appellee, the Board of Physician Quality Assurance (BPQA). In this case, we must decide whether a physician’s sexual harassment of hospital employees, which occurred while the physician was working in a hospital but not while he was treating patients, was “conduct within the practice of medicine.” We conclude that some of the doctor’s actions constituted conduct within the practice of medicine and thus were subject to disciplinary action, because they occurred during the diagnosis, treatment, or care of patients. Because the circuit court found that all misconduct was during the practice of medicine, we affirm in part and reverse in part and remand the case to the BPQA to determine the appropriate punishment. Dr. Banks’s appeal arises under the following circumstances.
Dr. Banks was and is licensed to practice medicine in Maryland. In 1986, Professional Emergency Physicians, Inc. (PEP), which provided emergency department physicians and physicians’ assistants to four Maryland hospitals, employed Dr. Banks to serve as house physician at Carroll County General Hospital (CCGH). As a house physician, Dr. Banks was expected to work 12 hour shifts and perform duties including the following: admitting patients for private attending physicians; writing histories and physicals or admitting notes; writing admitting orders to facilitate the patient’s admission to the hospital; assisting in the operating room; caring for any acute patient problems or any non-acute problems at the request of the attending physicians; and, at times of high volume, assisting in the emergency department.
Because house physicians were new to CCGH when Dr. Banks began, the hospital staff was unsure which tasks were to be delegated to the house physician. This resulted in minimal use of Dr. Banks by the medical staff and significant down time for him. As a result of the underutilization, Dr. Banks would often agree to work 24 and 36 hour shifts. When on duty, Dr. Banks was not free to leave the hospital and was expected to be available at all times. But when he was not *253involved in patient care, he was free to sleep, eat, watch television, use the telephone, and read in the lounge. Often, during his “down time,” he would circulate around the building and chat with hospital staff.
Incidents of Sexual Harassment1
Of the five women whom Dr. Banks admittedly harassed, three testified against him at the BPQA hearing before an Administrative Law Judge.2 ‘Witness one” was a secretary on the east wing of CCGH. On several occasions when Dr. Banks was called to this wing, he would run his hands through witness one’s hair and rub her shoulders. On one occasion, while she was in the kitchen with Dr. Banks, he got up and closed the kitchen door for no reason. She became very frightened and immediately left the room. To avoid conflict, and because she feared getting into trouble, witness one walked away and did not report either incident.
On another occasion, Dr. Banks came up behind witness one at her work station and touched her around her waist and stomach. She demanded that he leave her alone. She told her supervisor about the incidents and followed up with a written report describing Dr. Banks’s repeated touchings and rude, sexually suggestive comments. The report indicated that Dr. Banks’s offensive conduct often occurred in areas where patients, visitors, and other staff could observe the advances.
Another victim of Dr. Banks’s harassment was a unit secretary in the emergency department (witness two). In July *2541987, witness two was using the Addressograph3 and Dr. Banks was waiting behind her to stamp some documents for a patient he was admitting to the hospital. Dr. Banks slapped her on her backside, causing her to jump in surprise.
About four years after the first incident, witness two was going to clean herself up after spilling coffee on her pants and shoes. Dr. Banks asked her to go to the records room and retrieve a patient’s chart for him. Witness two indicated that she would get the chart as soon as she finished cleaning herself. Dr. Banks responded, ‘Why don’t you just let me lick it off?” Witness two told him he was disgusting and retrieved the record.
While witness two was working at her desk a few weeks later, Dr. Banks came over and asked when she was going out with him. At this point, witness two reported the incidents of harassment to hospital administration.
The final victim of Dr. Banks’s harassment was an emergency department registrar (witness three). The first day Dr. Banks met witness three, he asked her out for drinks. She replied that she was only 19 and that she had a boyfriend. Almost two years later to the day, as witness three was exiting a restroom, Dr. Banks grabbed her and pinned her against the wall with his hands and his knees. They were so close together that their stomachs were touching. Dr. Banks asked, “Is it going to be your place or mine?” Witness three responded, “Neither.” Dr. Banks then asked, “When will it be?” Witness three answered, “Never.” An orderly who observed the incident restrained Dr. Banks enough to allow witness three to escape. At the request of a nursing supervisor, witness three prepared a written report of the incident. She also initiated legal action against Dr. Banks, PEP, and CCGH. During all of these incidents, Dr. Banks was wearing scrubs.
*255Following this incident, an employee of PEP and the Director of the Emergency Department at CCGH counseled Dr. Banks on these incidents. At the conference, Dr. Banks stated that he did not need counseling. After being given several options on how to deal with the charges, Dr. Banks chose to take a leave of absence. As a result of Dr. Banks’s unprofessional conduct, the Board of Directors at CCGH denied his application for privileges, essentially terminating his employment at the hospital. The hospital administration reported the action it took against Dr. Banks to the BPQA, as is required by law.4
After receiving the information from CCGH, the BPQA voted to charge Dr. Banks with violating Md.Code Ann., Health Occ. § 14~404(a)(3) (1994 Repl.VoL). That section provides, in pertinent part:
(a) In general.—Subject to the hearing provisions of § 14-405 of this subtitle, the Board, on the affirmative vote of a majority of its full authorized membership, may reprimand a licensee, place any licensee on probation, or suspend or revoke a license if the licensee:
(3) Is guilty of immoral or unprofessional conduct in the practice of medicine.
Public charges were issued by BPQA a short time later.
Dr. Banks filed with the BPQA a Motion to Dismiss, contending that disciplinary action was outside the scope of *256BPQA’s authority because the conduct in question was not within “the practice of medicine.” The case, including Dr. Banks’s Motion to Dismiss, was referred to the Office of Administrative Hearings for adjudication. After a hearing on the Motion to Dismiss was held, the Administrative Law Judge (ALJ) reserved ruling on the motion until after the entire case was heard. The ALJ later denied Dr. Banks’s request for reconsideration of her deferral of action on his motion.
After a hearing, the ALJ concluded that Dr. Banks had violated [¶] § 14-404(a)(3) by committing unprofessional conduct in the practice of medicine. Specifically, the ALJ found that the following two incidents occurred within the practice of medicine: (1) when Dr. Banks slapped witness two on the buttocks while she was using the Addressograph to stamp documents in order to admit a patient and Dr. Banks was waiting to use the machine; and (2) when Dr. Banks requested that witness to allow him to lick the coffee off her pants after he had asked her to obtain a medical record for him. The ALJ also concluded, however, that Dr. Banks was not engaged in the practice of medicine during the incidents with witnesses one and three and, therefore, was not subject to. any disciplinary action with regard to those witnesses. The ALJ recommended that Dr. Banks be reprimanded and undergo psychiatric evaluation and treatment Neither party filed exceptions and, a short time later, the BPQA convened to act on the ALJ’s recommended decision.
The BPQA’s memorandum and order adopted the ALJ’s findings of fact. It agreed with the ALJ’s conclusion with regard to witness two, but disagreed with the ALJ’s conclusions with regard to witnesses one and three. The BPQA was convinced, by clear and convincing evidence, that Dr. Banks had engaged in immoral, or unprofessional conduct in the practice of medicine by sexually harassing all three workers. It found that all of Dr. Banks’s action fell within “the practice of medicine” because his on-call status, during which he was expected to be available for admissions, treatment of patients, and for assistance in the operating and emergency rooms, *257placed his activities squarely within the practice of medicine. The BPQA based this conclusion, in part, on the consideration that “a hospital environment must at all times be conducive to the practice of medicine,” requiring intensive team effort between physicians and hospital staff. The BPQA ordered that Dr. Banks be reprimanded and placed on probation, that Dr. Banks see a psychiatrist and, if the psychiatrist recommends, that Dr. Banks undergo psychotherapy with a therapist approved by the BPQA.
Dr. Banks appealed to the Circuit Court for Carroll County, which affirmed the BPQA’s order. The trial judge found that substantial evidence supported the BPQA’s findings and that his own independent review of the evidence supported the decision. On the issue of whether Dr. Banks was engaging in the practice of medicine when he harassed the other hospital employees, the trial judge concluded that Dr. Banks was “in uniform” and in the hospital for the sole purpose of practicing medicine, noting that physicians should not be able to insulate themselves from discipline “by merely declaring that they were on a coffee break.”
Dr. Banks noted a timely appeal from the circuit court’s order and presents for our review a single issue, which we have rephrased slightly:
Was the “immoral or unprofessional” conduct committed by Dr. Banks “conduct in the practice of medicine”?
We answer this question both in the affirmative and in the negative and reverse in part and affirm in part.
Standard of Review
An appellate court reviewing an administrative agency’s decision must determine if there was substantial evidence in the record to support the agency’s factual findings. Young v. Board of Physician Quality Assurance, 111 Md.App. 721, 726, 684 A.2d 17 (1996), cert. granted, 844 Md. 568, 688 A.2d 447 (1997). If substantial evidence exists, the court cannot substitute its judgment for that of the administrative agency. Id. An agency’s decision must be reviewed in the light most *258favorable to the agency, since decisions of administrative agencies are prima facie correct and carry with them the presumption of validity. Board of Education v. Paynter, 303 Md. 22, 35-36, 491 A.2d 1186 (1985).
When an agency makes an erroneous legal conclusion, however, an appellate court affords no deference to the administrative agency and may substitute its own judgment on the legal issue for that of the agency. Young, 111 Md.App. at 726, 684 A.2d 17. Because an agency’s finding that a physician’s immoral or unprofessional conduct occurred in the practice of medicine is an application of law to facts, see Ramsay, Scarlett & Co. v. Comptroller, 302 Md. 825, 834-39, 490 A.2d 1296 (1985), we may substitute our own judgment for that of the agency as to the legal issue. With our standard of review in mind, we turn to a discussion of the merits of the case.
Discussion
BPQA charged Dr. Banks under Md.Code Ann., [¶] § 14-404(a)(3) (1994 Repl.Vol.). That section reads, in pertinent part:
(a) In general. Subject to the hearing provisions of § 14-405 of this subtitle, the Board, on the affirmative vote of a majority of its full authorized membership, may reprimand a licensee, place any licensee on probation, or suspend or revoke a license if the licensee:
* * *
(3) Is guilty of immoral or unprofessional conduct in the practice of medicine.
Id.
Dr. Banks does not challenge the finding that his conduct was immoral and unprofessional; he argues that his conduct did not occur “in the practice of medicine.” The Court of Appeals faced the issue of whether a physician’s immoral conduct occurred “in his practice as a physician” in McDonnell v. Commission on Med. Discipline, 301 Md. 426, 483 A.2d 76 (1984). Dr. McDonnell was sued by a former patient for *259malpractice. During the trial, Dr. McDonnell contacted the mentors of the plaintiffs two expert witnesses who were to testify against him. His reason for making the call was ostensibly to make certain that the testimony of the witnesses would be honest, reasonable, and medically accurate. The real purpose of the call was to have the mentors exert pressure on their pupils not to break the “veil of silence,” which was a longstanding tradition within the medical profession that doctors should not testify against other physicians in malpractice actions. When the malpractice case was over, medical disciplinary proceedings were instituted against Dr. McDonnell by the Commission on Medical Discipline, which was the precursor of the BPQA. Id. at 428-29, 483 A.2d 76.
The Commission on Medical Discipline, which at that time was a part of the Department of Health and Mental Hygiene, charged Dr. McDonnell under Art. 43, § 130(h)(8), with “immoral conduct of a physician in his practice as a physician.” The Commission found that Dr. McDonnell knew or should have known that contacting the experts’ mentors “was clearly intimidating and was improper.” The Commission concluded as a matter of law that Dr. McDonnell violated § 130(h)(8) as charged and reprimanded him. Id. at 429-31, 483 A.2d 76.
Dr. McDonnell appealed to the Circuit Court for Baltimore City. The lower court found the Commission’s decision was based on an erroneous application of the law to the facts on two bases: (1) that Dr. McDonnell’s conduct was not immoral; and (2) that Dr. McDonnell’s conduct did not occur “in his practice as a physician.” Id. at 431, 483 A.2d 76. This Court reversed, holding that Dr. McDonnell’s conduct was immoral and occurred in his practice as a physician. Comm’n on Medical Discipline v. McDonnell, 56 Md.App. 391, 467 A.2d 1072 (1983).
The Court of Appeals reversed this Court, holding that in order for conduct to be punishable under § 130(h)(8) it must “occur while in the performance of a physician’s practice within the contemplation of the ‘Practitioners of Medicine’ *260subtitle of Art. 43 and specifically § 119 thereof,”5 and that Dr. McDonnell’s misconduct was outside his practice of medicine. McDonnell, 301 Md. at 434, 483 A.2d 76. The Court of Appeals also pointed out that the legislature outlined and proscribed 19 forms of professional misconduct, and in only two had the additional requirement of “in his practice as a physician” been added.6 According to the Court of Appeals, this indicated that the unprofessional acts must occur during the diagnosis, care, or treatment of patients. Id. at 435, 483 A.2d 76.
Applying this standard to the facts, the Court concluded: “Unquestionably, Dr. McDonnell’s act in initiating the improper phone calls was related to his professional practice. But his act was not done in the course of actual practice of medicine.... Consequently, the imposition of the sanction of reprimand upon Dr. McDonnell must be vacated.” Id. at 436-37, 483 A.2d 76.
*261The current edition of the [¶] Code, § 14-101 (k), defines to “practice medicine” as follows:
(k) Practice medicine. (1) “Practice medicine” means to engage, with or without compensation, in medical:
(i) Diagnosis;
(ii) Healing;
(iii) Treatment; or
(iv) Surgery.
(2) “Practice medicine” includes doing, undertaking, professing to do, and attempting any of the following:
(i) Diagnosing, healing, treating, preventing, prescribing for, or removing any physical, mental, or emotional ailment or supposed ailment of an individual:
1. By physical, mental, emotional, or other process that is exercised or invoked by the practitioner, the patient, or both; or
2. By appliance, test, drug, operation, or treatment;
(ii) Ending of a human pregnancy; and
(iii) Performing acupuncture.
(3) “Practice medicine” does not include:
(i) Selling any nonprescription drug or medicine;
(ii) Practicing as an optician; or
(iii) Performing a massage or other manipulation by hand, but by no other means.
Id.
The code in effect at the time McDonnell was decided penalized “immoral conduct of a physician in his practice as a physician”; the code under which Dr. Banks was charged subjected a physician to reprimand or penalty if he or she was “guilty of immoral or unprofessional conduct in the practice of medicine.” We do not believe the distinction between the two statutes is of any practical significance. Therefore, while the current statutes are not identical to the statutes in force when McDonnell was decided, they are similar enough to persuade us that the language of McDonnell is controlling in the instant case. In McDonnell> the Court of Appeals required that the *262physician’s immoral or unprofessional conduct must have occurred during the diagnosis, care, or treatment of patients before he or she could be disciplined under the statute. McDonnell, 301 Md. at 437, 483 A.2d 76. We believe [¶] § 14-404(a)(3) should receive the same interpretation. The BPQA argues that a liberal interpretation of the statute is required; it argues that any actions taken by Dr. Banks while on call in the hospital occur within the practice of medicine. They theorize that because Dr. Banks’s practice requires that he is available at a moment’s notice whenever needed, he is still practicing medicine even though he has significant periods of time in which he is waiting to be given a task. This reasoning is in accord with that of the circuit court. The circuit court felt that, since Dr. Banks was dressed in scrubs and was at the hospital for the sole purpose of practicing medicine, he was, at all times, in the practice of medicine within the meaning of [¶] § 14-101(k). The circuit court also theorized that in a particular workday it is neither possible, nor necessary, to characterize each separate activity or moment of activity. All that was needed was that the predominant purpose of Dr. Banks’s presence at CCGH on the days in question was for the purpose of practicing medicine. We disagree.
The purpose of disciplinary proceedings against licensed professionals is not to punish the offender but rather a catharsis for the profession and a prophylactic for the public. Nevertheless, because there is a punitive aspect to the proceedings, statutes which authorize the imposition of sanctions against the licensed professional should be strictly construed against the disciplinary agency.
McDonnell, 301 Md. at 436, 483 A.2d 76 (citations omitted).
When construing a similar statute in McDonnell, the Court of Appeals clearly indicated that in order for conduct to occur in a doctor’s practice it must be in the diagnosis, care, or treatment of patients. McDonnell, 301 Md. at 437, 483 A.2d 76. In the instant case, the only incidents of sexual harassment that occurred when Dr. Banks was diagnosing, caring for, or treating patients occurred with witness two. Despite *263Dr. Banks’s presence in the hospital for the purpose of practicing medicine and his attire while at the hospital, there is no evidence that he was diagnosing, caring for, or treating patients while he was sexually harassing witnesses one or three.
Witness one was the east wing secretary. On one instance, Dr. Banks was in the kitchen heating soup for his meal when he harassed her. This is clearly not the diagnosis, care, or treatment of patients. On the other occasions, he harassed her at her workstation. In the hearing before the ALJ, witness one could not recall why Dr. Banks was on the east wing when the events she described occurred. The ALJ concluded that given Dr. Banks’s underutilization during the period in question it is likely that he was simply passing time, not treating patients. This Court is required strictly to construe that statute against the disciplinary agency.
With respect to the incident with witness three, while Dr. Banks’s actions were offensive and reprehensible, there was no suggestion that Dr. Banks was diagnosing, caring for, or treating patients when the incident occurred. The incidents occurred in the hallways as the two passed one another.
The events with witness two occurred when Dr. Banks: (1) and witness two were waiting to use the Addressograph machine; and (2) requested that witness two obtain a patient record. Dr. Banks was waiting to use the Addressograph machine in order to facilitate the admission of a patient; the admission of a patient falls within the definition of diagnosing, caring for, or treating a patient. While stamping a record on the Addressograph is clerical in nature, it is a necessary procedure and is part of the treatment of a patient. Accordingly, while Dr. Banks was waiting to use the Addressograph, he was “in the practice of medicine.”
For the same reasons, Dr. Banks’s actions when asking a staff member to obtain a record for him also were in the practice of medicine. As the ALJ stated in her proposed decision, “[Dr. Banksl’s activities in these two (2) incidents go *264well beyond the ‘general or associative’ relationship to the physician discussed in McDonnell, and fall clearly within the actual performance of the practice of medicine, and the proscription of [¶] § 14-404(a)(3), immoral or unprofessional conduct in the practice of medicine.”
If we were to hold that the sexual harassment of witness two was outside the scope of [¶] § 14-404(a)(3), it would render that section a nullity. Here, the harassment occurred when Dr. Banks was waiting to perform a clerical task required to admit a patient for care at the hospital and after he requested a nurse to get a patient’s chart so he properly could make a diagnosis. If the two situations in the instant case were outside the practice of medicine, the only way conduct would fall within the statute is if the doctor was physically touching a patient while committing the immoral conduct. For example, if the statute is to be construed to exclude Dr. Banks’s two previously mentioned incidents with witness two, the following incidents must be outside the scope of the statute: a radiologist exposes himself to his secretary while examining an x-ray to determine if a patient has a broken bone; an oncologist rubs a nurse’s thigh while dictating the result of an earlier patient examination. We think such an interpretation would be clearly outside what was intended by the legislature.
For this reason, we must affirm the decision of the trial court with respect to witness two. We reverse the circuit court’s decision with respect to witnesses one and three and remand the case with instructions that the circuit court remand to the BPQA for reconsideration of its disposition consistent with this opinion.
JUDGMENT AFFIRMED IN PART AND REVERSED IN PART.
CASE REMANDED TO THE CIRCUIT COURT FOR CARROLL COUNTY WITH DIRECTIONS THAT IT FURTHER REMAND THE CASE TO THE BPQA FOR FURTHER PROCEEDINGS CONSISTENT WITH THIS OPINION.
*265COSTS TO BE PAID ONE-HALE'' BY APPELLANT AND ONE-HALF BY APPELLEE.
. Dr. Banks does not dispute that any of the incidenls of harassment took place.
. There were two incidents of harassment by Dr. Banks in which the witnesses did not testify. The first occurred on 21 December 1987, when Dr. Banks made a comment to a nurse that he would "like to get Lher] behind closed doors.” The second took place on 11 May 1988, when Dr. Banks made a comment to a female employee in the medical records department that if a woman wore red on certain days it indicated she was sexually promiscuous. The employee was, reportedly, in tears about the comment.
. An Addressograph is used to stamp a patient’s chart or to make labels from patient's identification cards and apply them to, for example, a blood tube.
. The BPQA is the state regulatory agency charged with licensing and disciplining Maryland physicians pursuant to the Maryland Medical Practice Act, codified in [¶] Title 14. Based on its preliminary investigation of complaints and information received from complainants, BPQA will vote to charge a licensee with violations of PIO § 14-404 if it determines lhat reasonable cause exists to support the charges.
The subject physician of disciplinary action is then entitled to a contested case hearing on the merits pursuant to the Maryland Administrative Procedures Act, codified in Md.Code Ann., State Gov't §10-201 (1995 Repl.VoL). Based on the record of the contested case hearing conducted before an administrative law judge, BPQA makes findings and conclusions, and imposes an appropriate sanction if it determines that the Medical Practice Act has been violated.
. Article 43 § 119 defined practice of medicine to mean the exercise of "the art of science and medical diagnosis, healing, or surgery” including:
(1) Operating on, professing to heal, prescribing for or otherwise diagnosing or treating any physical, mental or emotional or supposed ailment of another.
(2) Undertaking by appliance, test, operation, or treatment to diagnose, prevent, cure, heal, prescribe for, or treat any bodily, mental or emotional ailment or supposed ailment of another.
(3) Undertaking to treat, heal, cure or remove any physical, emotional or mental ailment or supposed ailment of another by mental, emotional or other process exercised or invoked on the part of either the physician, the patient, or both.
(4) Assisting, attempting, inducing, or causing by any means whatsoever the termination of a human pregnancy.
(5) Performing acupuncture.
. The statute in force in McDonnell has been revised. The current statute, [¶] § 14-404 has 30 forms of physician misconduct instead of the 19 proscribed under former § 130(h)(8). Of the 30 forms of physician misconduct under § 14-404, only three limit the proscription to "in the practice of medicine.” Therefore, the reasoning of the Court of Appeals in McDonnell that the conduct must occur during the practice of medicine has equal force when interpreting the current statute.