There appeared to be no doubt last month about why Detective Robert Redanauer was in Judge James Murray Lynn’s courtroom.

Redanauer, a recently terminated Philadelphia police investigator with a history of erratic behavior, was arrested in April after Internal Affairs alleged that he had threatened a 16-year-old boy and pulled a gun on the youth’s 23-year-old brother while inside their mother’s Northeast Philadelphia home.

Naked and stumbling around the woman’s bedroom, the off-duty Redanauer, 51, allegedly stated, “Come here, f—er. I am going to shoot you,” while aiming a handgun at his face.

On July 15, when Redanauer appeared before Lynn to face charges of simple assault and making terroristic threats, everyone in the courtroom operated as if it was a Municipal Court preliminary hearing.

The purpose of such hearings is to determine if there is enough evidence to hold a defendant for trial before a jury in Common Pleas Court. The burden of proof is much lower than at a trial.

» READ MORE: A longtime Philadelphia judge won’t wear a mask in court, prompting complaints from lawyers and witnesses

In court, the prosecutor, defense attorney, Lynn, and even the stenographer each described the proceeding as a preliminary hearing. The title of the transcript: “preliminary hearing.”

But at the end of the proceeding Redanauer’s attorney, Raymond Driscoll, introduced a curveball argument: that due to a procedural technicality, what had just taken place was not a preliminary hearing, but the trial itself.

Lynn accepted Driscoll’s argument on the spot, retroactively ruling that it was, in fact, a trial that he had presided over.

“The defendant is not guilty,” Lynn stated, clearing Redanauer of all charges involving both of the woman’s sons — despite the older son’s testimony about having been threatened.

For now, Redanauer is a free man.

Legal experts who reviewed the transcript at The Inquirer’s request were puzzled by the case.

It raises questions, they say, about fairness in the Philadelphia court system — including whether civilians get the same treatment as police officers — but also larger legal questions about criminal procedure, such as: What defines a trial?

» READ MORE: ‘Please, don’t shoot me’: Complaints and lawsuits piled up for years before a Philly detective was arrested

“My sense is that the defense lawyer had a very sympathetic judge and a really interesting hook,” said Daniel Filler, dean of Drexel University’s Kline School of Law. But, he added: “Can a trial happen when nobody knows it’s a trial? I don’t know.”

Nora V. Demleitner, a professor at Washington and Lee University School of Law, said she was “mesmerized” by the proceeding.

“This is insane. This is stunning. Everything about it is,” Demleitner said. “If I were a member of the public reading this, the conclusion I’m drawing right now is, I’m never going to testify, certainly not against a police officer, because why bother?”

District Attorney Larry Krasner said this week that he plans to appeal Lynn’s ruling to the state Superior Court, calling the case “jaw-dropping,” “ridiculous,” and “bizarre.” He said that he’d never heard such an argument in 33 years of practicing law.

“It’s so upside-down world you don’t even know where to begin,” Krasner said.

That such an unusual case would come out of Lynn’s courtroom is perhaps not surprising.

First elected to Common Pleas Court in 1991, Lynn was rated “not recommended” by the Philadelphia Bar Association when he ran for retention in 2001 and 2011.

Former Daily News columnist Jill Porter reported extensively on his reputation around the courthouse, including a 2001 column in which she wrote that he once entered the courtroom in the late morning, required people to recite the Pledge of Allegiance, then left without conducting any court business.

In 2012, the Daily News reported on the unwritten opinions piling up on Lynn’s desk, delaying cases for up to 18 months.

Last summer, Lynn drew complaints from lawyers and witnesses for refusing to wear a mask in his small, windowless courtroom during the coronavirus pandemic. He later tested positive for COVID-19.

Martin O’Rourke, a spokesperson for the First Judicial District of Pennsylvania, said Lynn did not have any comment on the case.

During the Redanauer proceeding, Lynn immediately chastised Assistant District Attorney Kristin Johnson when she questioned what the prosecution witness was wearing.

“Who cares? Why do you care?” Lynn asked. “We are at a preliminary hearing. Why are we talking about this man’s clothes? Don’t waste my time.”

Lynn then questioned her ability, asking her: “Have you been doing this long?”

As for Redanauer, the testimony against him was not contested by any defense witnesses.

The woman’s older son, now 24, a medical student who said he previously served in the Air Force, testified that he heard Redanauer arguing with his 16-year-old brother from inside their mother’s bedroom late at night last December.

“I go upstairs and open my mom’s bedroom door, and this guy is in the process of grabbing a silver semiautomatic pistol off of the dresser,” the man testified, describing Redanauer as “stumbling, insanely drunk,” and naked.

“I immediately put my hands up,” he continued. “I begin to back up. ‘Please, don’t shoot me. Please, don’t shoot me.’ He continues to advance on my position and he says, ‘Why don’t you come here so I can f—ing shoot you.’”

(The Inquirer is not disclosing the name of the witness to protect the identity of his brother, who is a minor. The younger brother and the mother were not in the courtroom.)

After his arrest, Redanauer was terminated by Police Commissioner Danielle Outlaw, who called his off-duty behavior “intolerable.”

The Inquirer reported in May on previous incidents and settled lawsuits involving Redanauer, including allegations that he shot a fellow officer in the leg, smashed a car windshield in what police say was an act of vandalism, made wrongful arrests, attacked a firefighter outside a bar, and threw a domestic-abuse victim into a vending machine, among other assaults.

In court, Driscoll, Redanauer’s defense attorney, argued that Redanauer went for his gun that night to “make sure he is safe.”

“He reacts in the way most of us react when we are either woken up or half asleep,” Driscoll said, adding that Redanauer then left the house. “He didn’t push anyone down, make the threat last longer, escalate violence in any way. He did the best thing anyone in that situation could have done, de-escalated the best he could.”

Johnson, the assistant district attorney, disagreed.

“The first thing a reasonable person does is not reach for their firearm,” she said in her closing argument. “They might tell the kids to leave the room, they might wave them out, but they don’t grab a gun and say, ‘Come here, f—er,’ to two kids. That is not a typical response to someone.”

Driscoll’s successful argument for changing the preliminary hearing to a trial was based on his assertion that the DA’s Office had improperly filed one of its requests for a Common Pleas jury trial.

The defense attorney declined to comment for this article.

Jules Epstein, a professor at Temple University’s Beasley School of Law, said the case is “something of a procedural quagmire.”

“Unless an appellate court were to rule that there was no trial at all, then the pronouncement of ‘not guilty’ is final under double jeopardy principles,” Epstein said.

Filler, the Drexel law school dean, said that while the case is “very weird,” praised Driscoll for paying close attention to detail and advocating creatively for his client. He said the outcome, though, could lead to negative perceptions about the courts.

“A lot of people might ask if this had been a poor, Black, unemployed man, first of all, would he have gotten the same [legal] representation?” Filler asked. “Second of all, would the judge have been willing to so rapidly reach this conclusion?”

Demleitner, the Washington and Lee law professor, said the evidence is clear: Redanauer should have been held for trial based on the testimony.

“This strikes me as more than peculiar behavior on the part of the judge,” she said.