Joel Johnson

It was one unarmed man against two armed intruders, and in the struggle, the victim wrested a gun away and shot one assailant dead. The second attacker, police said, jumped from a third-floor window.

When it was over Wednesday night, authorities discovered that the man lying dead on the Southeast Washington apartment floor was no stranger to them; he had played a role in the killing of District junior high school principal Brian K. Betts two years ago in Silver Spring.

Joel Johnson, once charged with murder, had taken a deal and pleaded guilty to a lesser charge of accessory after the fact in exchange for his promise to testify against the gunman, who was sentenced to 40 years in prison. Multiple law enforcement officials on Thursday confirmed the dead man’s role in the Betts case.

Johnson, 21, was sentenced to five years in prison with all but 18 months suspended, and he walked out a free man in April 2011, according to the Montgomery County state’s attorney’s office.

On Wednesday night, D.C. police said, Johnson died of a bullet to the head that was fired by the occupant of a third-floor apartment who fought his attackers as a female companion hid in a back bedroom. She jumped from a third-floor window to escape harm, according to police.

Brian K. Betts. (Nikki Kahn)

Investigators were still scouring the area around the apartment building in the 4200 block of First Street SE late Thursday afternoon. A uniformed police officer was parked outside, and three homicide detectives went door to door in the brick building. One detective said the couple who lived upstairs was in protective custody.

Two days earlier and five blocks away, D.C. police said, two armed men accosted another victim, robbed him and forced him inside his apartment. There, police said, one of the attackers sexually assaulted a woman who lived inside.

Authorities declined to say whether the attacks were linked. A man who identified himself as the victim in the first case shouted, “No comment,” through his apartment door.

D.C. police released little information Thursday about the second attack, in part because detectives are still seeking the second assailant. The preliminary police report leaves out even basic identifiers, including the ages of the victims, and sums up the battle for the gun quickly.

In a statement, police said the occupant was attacked by two gunmen as he walked into his apartment building shortly before 8:30 p.m. Police said the men “forced their way into the complainant’s apartment in what is believed to be an effort to rob him.”

Police said “a struggle ensued between the complainant and one of the suspects,” who was shot. A detective at the scene Thursday said Johnson was killed by a single shot to the head.

Authorities declined to provide more details of the fight. The police report confirms that the other gunman and the woman jumped from a window. On Thursday, a broken screen and what appeared to be a blanket or sheet covering the opening were visible from the ground below. Inside, the apartment door was sealed with evidence tape.

District police said no charges have been filed against the apartment’s occupant, although the matter remains under investigation.

Kristopher Baumann, head of the D.C. police union, lashed out at the plea deal and sentence afforded Johnson.

“It is inexcusable that we don’t keep these people behind bars and away from anyone else,” Baumann said Thursday.

“This is the failing of our system. . . . It is beyond comprehension what happened to these poor people.”

But Ramon Korionoff, a spokesman for the Montgomery County state’s attorney’s office, said prosecutors needed Johnson to persuade three other suspects, including the gunman, to plead guilty in the killing of Betts, who was principal at Shaw Junior High School in Northwest Washington.

“Joel Johnson was a cooperating witness with our prosecutors in that case,” Korionoff said. “With his cooperation, we were able to put the weapon in the hands of the antagonist in this crime.”

Korionoff said Johnson had a lesser prior criminal record than the others and was not directly involved in the shooting on April 14, 2010.

As detectives built their case in Betts’s killing, authorities said, they learned that Alante Saunders had called a sex chat line, linked up with Betts and set up a meeting for the purpose of robbing him.

He arrived at Betts’s house with Johnson and two others, went inside and shot Betts in an upstairs bedroom.

Johnson was inside when Betts was shot, according to prosecutors. His attorney, Philip Armstrong, said his client ended up with the others that night only because he needed a ride to a girl’s house. After waiting outside the house, he went in to check on Saunders.

Inside, he “was unfortunately witness to a pretty horrific scene,” Armstrong said. “He cleared out of there quick.”

Within two hours of the shooting, surveillance cameras caught images of Johnson and others at a gas station where at least one of Betts’s stolen credit cards was used, prosecutors said.