HARRISBURG, Pa. (AP) — Canines in the courtroom? The Pennsylvania Supreme Court says yes — under certain conditions.

A trial witness may be accompanied by a “comfort dog” if the animal will help yield reliable, complete and truthful testimony, the justices ruled Wednesday in a precedent-setting opinion that established a “balancing test” for Pennsylvania judges confronted with such a request.

READ MORE: Pennsylvania Primary: What Philadelphia Voters Need To Know Ahead Of Tuesday's Election

Ruling unanimously in a murder case, the Supreme Court pointed to other states that allow witnesses to testify with the help of emotional support dogs. The justices said it’s permissible, as long as steps are taken to minimize any potential harm to a defendant.

“Trial courts have the discretion to permit a witness to testify with the assistance of a comfort dog,” Chief Justice Max Baer wrote for the court. “In exercising that discretion, courts should balance the degree to which the accommodation will assist the witness in testifying in a truthful manner against any possible prejudice to the defendant’s right to a fair trial.”

The defendant, Sheron Purnell, was convicted of third-degree murder in the 2016 shooting death of a man in Coatesville and was given a prison sentence of up to 47 years.

Purnell’s lawyers argued that a Chester County judge abused his discretion by allowing a comfort dog to accompany a teenage witness who testified against Purnell at trial. The defense argued the dog, part of the sheriff’s K-9 unit, would “generate sympathy” among jurors for the girl.

Prosecutors argued the dog was trained to accompany witnesses in court and would help allay the girl’s fear of testifying.

READ MORE: Nearly 40,000 Early Votes Already Cast In Bucks County, But Election Officials Still Warn Results May Be Delayed

The judge allowed it but said the dog, a black Lab named Melody, had to remain under the witness stand throughout the teenager’s testimony. He also instructed jurors to ignore the dog for purposes of assessing the witness’s credibility and said they should not view her more sympathetically.

The Supreme Court said the judge had acted reasonably.

“We note that there is nothing in the record to suggest that the comfort dog was in any way disruptive to the trial,” the court said.

The justices adopted rules established by Connecticut’s high court and said they would apply to Pennsylvania state court cases. Judges can limit any potential prejudice to a defendant by blocking jurors’ view of the dog and giving appropriate jury instructions, the court said.

Justice Christine Donohue endorsed the majority’s adoption of a balancing test but said that in the Purnell case, prosecutors “presented no evidence to demonstrate that the presence of the sheriff’s dog would enable the witness to testify more reliably and completely.”

She said Purnell’s lawyers had failed to argue the point at trial, preventing them from raising it on appeal.

MORE NEWS: Public Works Crews Across Delaware Valley Prepare For Arrival Of Anticipated Severe Weather

(© Copyright 2021 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)