
60 Wn. App. 624 (1991)
806 P.2d 249
DEBRA LYNN WALKER, as Personal Representative, ET AL, Appellants,
v.
THE STATE OF WASHINGTON, Respondent.
No. 13005-0-II.
The Court of Appeals of Washington, Division Two.
March 6, 1991.
Vernon W. Harkins, Rush Hannula & Harkins, Gene Godderis, and Godderis & Candoo, for appellants.
Kenneth O. Eikenberry, Attorney General, and Stewart A. Johnston, Assistant, for respondent.
PETRICH, J.
In October 1986, Police Officer Larry Walker was killed and Officer David Paul injured when Paul's gun discharged as Paul struggled to subdue Jeffrey Westmark. Debra Walker, personal representative of the *626 estate of Larry Walker, and David Paul appeal a summary judgment dismissing their claim that the State of Washington, through Western State Hospital, negligently caused Officer Walker's death and Officer Paul's injuries. We affirm.
[1] On appeal from a summary judgment, this court engages in de novo review; we make the same inquiry as the trial court, looking to the pleadings, depositions, admissions, and affidavits to determine if there are any genuine issues of material fact and if the moving party is entitled to judgment as a matter of law. Wilson v. Steinbach, 98 Wn.2d 434, 437, 656 P.2d 1030 (1982).
In July 1986, Jeffrey Westmark was arrested and charged with assault in the second degree and theft in the second degree. At Westmark's arraignment, the trial court ordered that Westmark be admitted to Western State Hospital for a 15-day competency evaluation. After 15 days, psychologist Carl Redick and psychiatrist Thomas Corlew submitted a written evaluation to the court, advising the court that Westmark was incompetent to stand trial. The court then signed an order extending Westmark's commitment for 90 days. Shortly thereafter, the doctors advised the court that Westmark was competent to stand trial. Westmark was promptly returned to Pierce County Jail.
Westmark's behavior apparently deteriorated. The court sent Westmark back to Western State for an additional competency evaluation. Dr. Corlew advised the court that Westmark was competent to stand trial, although he failed to inform the court that he had also determined that Westmark was very dangerous. Upon returning Westmark to the Pierce County Jail, Dr. Corlew placed him on administrative leave rather than discharging him in order to simplify the paperwork should Westmark return. Westmark eventually pleaded guilty to the charges against him. The trial judge released Westmark on his own recognizance pending sentencing. Upon learning of this, Dr. Corlew discharged Westmark from "administrative leave" status at Western State.
*627 A few days later, Officers Paul and Walker responded to a domestic violence call at the Westmark residence. Westmark attacked Paul injuring him with a knife; they struggled and Officer Paul's weapon discharged, accidentally killing Officer Walker.
Walker and Paul argue that Western State was negligent (1) in failing to inform the trial court that Westmark was substantially dangerous, (2) in discharging Westmark from the hospital, and (3) in failing to petition the trial court to involuntarily commit Westmark.
[2] We hold that judicial immunity insulates Western State from liability for the first two of its allegedly negligent acts and that a lack of duty precludes liability for the third. The doctrine of judicial immunity protects individuals who participate in judicial proceedings from civil liability for acts related to that participation. Bruce v. Byrne-Stevens & Assocs. Eng'rs, Inc., 113 Wn.2d 123, 129, 776 P.2d 666 (1989); Tobis v. State, 52 Wn. App. 150, 154, 758 P.2d 534 (1988). This doctrine has been extended to state mental health professionals acting in association with the judicial function:
When psychiatrists or mental health providers are appointed by the court and render an advisory opinion to the court on a criminal defendant's mental condition, they are acting as an arm of the court and are protected from suit by absolute judicial immunity.
Bader v. State, 43 Wn. App. 223, 226, 716 P.2d 925 (1986).
We find Bader dispositive. In Bader, Morris Roseberry was arrested for assault and sent by the Chelan Superior Court to Eastern State Hospital to determine competency. Eastern reported to the court that Roseberry was substantially dangerous but competent to stand trial. Roseberry was acquitted by reason of insanity. His release from custody was conditioned on his compliance with Eastern's recommendations for minimum security. Roseberry later killed his neighbor. The victim's estate sued Eastern for gross negligence because Eastern recommended minimal conditions of release for Roseberry despite its evaluation that *628 Roseberry was substantially dangerous. Bader, 43 Wn. App. at 226.
The Court of Appeals, Division Three, held Eastern immune from liability on grounds of judicial immunity. Bader, at 226. The Washington Supreme Court has clarified Bader, saying that Eastern was immune, "not because it partook of the judge's immunity, but because it took part in judicial proceedings." Bruce, 113 Wn.2d at 129. "The purpose of granting immunity to participants in judicial proceedings is to preserve and enhance the judicial process." Bruce, at 128.
Here, Western State participated in a judicial proceeding when it committed and evaluated Jeffrey Westmark at the behest of the trial court. The doctrine of judicial immunity absolutely protects Western State from liability for failing to inform the court of its conclusion that Westmark was substantially dangerous and for discharging Westmark from the hospital because both acts were clearly connected to Western State's participation in the judicial proceeding. See Bruce, at 129; Bader, at 226.
[3] Walker and Paul argue that Western State is liable under Petersen v. State, 100 Wn.2d 421, 671 P.2d 230 (1983). The Petersen court held that a psychiatrist has a duty to take reasonable precautions to protect anyone who might foreseeably be endangered by a patient's mental problems. Petersen, 100 Wn.2d at 428. Bader distinguished Petersen because the mental patient in Petersen "was not admitted to the mental hospital because of any crime he had committed and no recommendation was made to the court for his release...." Bader, at 226. In Bader, the psychiatrist acted at the behest of the trial court and the trial court was responsible for releasing the patient. When the trial court takes the evaluation of the mental health professional under advisement but retains the ultimate decisionmaking authority over the patient's release, judicial immunity protects the psychiatrist from liability. See Tobis v. State, 52 Wn. App. at 159. Here, the judge retained the ultimate decisionmaking power over Westmark's release; *629 therefore, Petersen is not controlling and the doctrine of judicial immunity applies.
However, judicial immunity does not protect Western State's failure to petition the court to involuntarily commit Westmark. Walker and Paul argue that Western State had a duty to petition the court even after Western State's participation in the judicial proceeding ceased.
[4, 5] The existence of a legal duty is an essential element in a negligence action. Metlow v. Spokane Alcoholic Rehabilitation Ctr., Inc., 55 Wn. App. 845, 848, 781 P.2d 498 (1989), review denied, 114 Wn.2d 1007 (1990). The determination of a legal duty is a question of law. Metlow, at 849. A person has a duty to protect a third party from causing injury to another "where a special relationship exists between a defendant and either a third party or the foreseeable victim of the third party's conduct." Metlow, at 849.
[6] Metlow involved an action against an alcohol treatment center and its counselors for failing to take reasonable precautions to protect persons who might have been foreseeably endangered by a patient's alcohol-related problems. Metlow, at 848. The court held that the defendants owed no duty to the plaintiffs. Metlow, at 850. In Metlow, the patient was not within the hospital's custodial control because he was a nonresidential outpatient who attended weekly sessions at the facility; therefore, no special relationship existed and the psychiatrist had no legal duty to warn persons who might foreseeably be endangered by a patient. Metlow, at 850; see Petersen, 100 Wn.2d at 428. The Metlow court distinguished Petersen because, there, the patient was within the hospital's control, care, and custody. Metlow, at 849.
Similarly, Western State owed no legal duty to Officers Walker and Paul. Westmark was discharged from the hospital after the court released him. He was not Western State's patient nor was he within the hospital's control. Therefore, Western State owed no legal duty and cannot be found liable for negligence.
*630 [7] Consequently, Walker's loss of consortium claim is also barred. In a wrongful death action, loss of consortium is an element of the damages and not a separate cause of action. Long v. Dugan, 57 Wn. App. 309, 313, 788 P.2d 1, review denied, 114 Wn.2d 1018 (1990).
Because the doctrine of judicial immunity applies and because the State had no legal duty to Officers Walker and Paul, we need not decide whether the State is immune from liability under the professional rescuer's doctrine.
Judgment affirmed.
WORSWICK, C.J., and ALEXANDER, J., concur.
Review granted at 117 Wn.2d 1001 (1991).
