In 2016, Dejuan George pleaded guilty to beating a woman so severely she spent five days in a hospital. That conviction meant he could no longer legally possess a gun.

So when police found a Glock in George’s family home two years later, they charged him with being a felon in possession of a firearm.

The unfurling of that case shows the complexities of such gun prosecutions in the District, where D.C. Police Chief Peter Newsham has repeatedly complained about repeat offenders driving a rise in homicides.

Authorities sought to keep George off the street while he awaited trial, but a D.C. Superior Court judge said police did not have enough evidence to directly link George to the weapon. The loaded semiautomatic handgun was in a bag George and his mother told officers was his, police said. But the bag was in a living room, a common area often crowded with others.

Judge Jennifer A. Di Toro — over repeated objections from a prosecutor — agreed with the defendant’s attorney that many people had access to the bag, and she freed George, 25, pending trial. He was awaiting his day in court in January when police said he fatally stabbed a man in Marvin Gaye Park over a $20 drug debt.

While George’s release left Newsham frustrated, the suspect’s defense attorneys and others say the judge’s ruling was appropriate given the circumstances of the arrest. Many recovered guns are found in homes or vehicles, making it challenging to link them to one person, and some weapons are shared. What seem the most straightforward of arrests quickly grow complicated as challenges arise in court from judges, attorneys and juries.

In February, prosecutors at the behest of the mayor began moving gun cases involving convicted felons out of Superior Court and into federal court, where sentences can be longer. Police have said 40 percent of the known homicide offenders in the city have a prior gun arrest.

George is now charged with second-degree murder while armed in the killing of Abdul Jabar Watts and has been ordered detained. The gun charge from August is pending as well.

In an interview, Newsham said it “just boggles my mind that a judge could say there isn’t probable cause” to detain George after his gun arrest. The chief, who also is an attorney, said investigators can try to find additional evidence to link George to the gun, such as seeking DNA, but he said the court could “in the meantime take a convicted, violent offender with a subsequent gun arrest off the street. The judge decided not to do that.” He said “they don’t seem to understand that it is the victims’ families that are suffering.”

Asked if he felt George would have been detained had his gun case gone to federal court, Newsham said, “I don’t know, but I hope so.”

Laura E. Hankins, general counsel for the Public Defender Service, which is representing George, said in a statement that he “was released in the gun case because a neutral judge found the police lacked the bare minimum of evidence required to support an arrest or detention.”

The statement added: “There is no reason to think that a federal court judge who would have applied the same constitutional principles would have found any differently than the Superior Court judge who released Mr. George. Mr. George is innocent of the most recent charges brought against him and is fully confident that once a fair fact finder reviews all the evidence he will be vindicated of that charge.”

Defense attorney Betty M. Ballester, who is not connected to the George case, said “probable cause trumps everything,” including decisions over pretrial release. She added, “I don’t think it would have worked out any differently in the federal system.” Another defense lawyer, Bernard S. Grimm, said Di Toro “had no choice” but to rule as she did. He conceded that, “common sense says it’s probably [the defendant’s gun],” but he said the law requires more substantive evidence.

Police raided the George home Aug. 16. Dejuan George was staying in the living room, police said, and two of his brothers had their own rooms. Their mother also lived there; an officer said in court there were at least 10 people in the house when police went inside, including several children.

According to an arrest affidavit, police said they found a gun in one bedroom and charged one George brother with illegally possessing a firearm. They said they found PCP in another brother’s bedroom and charged him with narcotics violations. They reported finding a second gun — the Glock — in one of several bags in the living room and charged Dejuan George.

At his client’s first court appearance, George’s attorney argued that the evidence was thin, according to a transcript of the hearing.

“Just because there’s a statement to say that the bags belong to my client does not indicate any sort of knowledge of the firearm or ammunition that’s in the bags,” said Nathaniel Mensah, who is with the Public Defender Service.

Assistant U.S. Attorney Nicole Raspa said it was undisputed that the bag with the gun belonged to George, “and the government submits that is enough for probable cause in this case.” She noted George’s felony assault conviction and that he was on supervised released from that case when the house was raided.

Di Toro, a former public defender in the District, responded that it was a close call but she found the probable cause tenuous. Although she did not throw the case out, she did rule that George could go home to await further court dates. She said, “There is probable cause that the bag belonged to Mr. George, but not that he had any knowledge of what . . . was inside it.”

At a September preliminary hearing, Magistrate Judge Sean C. Staples ruled there was enough evidence for the case to proceed. “This is not a close case for the court in terms of probable cause at all,” he said, according to a transcript of the hearing. He noted that Dejuan George’s mother had told police her son had been staying in the living room “in the area where his items in a bag were found, where a gun was found.”

But Staples continued to let George stay free until trial; the prosecutor at the hearing did not raise the issue. Both Staples and Di Toro, through a court spokeswoman, declined to comment, citing prohibitions against commenting on pending cases.

The U.S. attorney’s office, which prosecutes crimes in the District in both Superior Court and in federal, U.S. District Court, also declined to comment.

Roscoe Howard, a former federal prosecutor who served as U.S. attorney for the District from 2001 to 2004, said he would have charged all three George brothers with possession of the gun found in a bag.

“These are not easy questions, but the law will allow a number of people to actually possess a single gun,” he said, if it is in an area all the defendants controlled. “A group goes into a bank and robs it with one gun, everyone gets charged with gun possession.”

But Howard also said the judge who freed George made her decision on solid legal ground. “I don’t think the judge was wrong,” he said. “It’s just her position.”

The former prosector said he would have argued for George to be detained. He added, though, “I think everybody in this city takes their jobs seriously, gun crimes and all.”