Judge Terrence McGann was set to punish three men who — disguised as house painters — had talked their way into an apartment where they knew the manager of a check-cashing business lived.

But their plan, which relied on forcing the manager to give them keys to the business and codes to its safe, had gone terribly awry. The innocent residents, with knives pulled on them, were held and tied up overnight. One was slashed in his neck in front of his 7-year-old son.

“What kind of sentence,” McGann asked, “does a judge give to three outlaws who terrorized an entire family over a 12-hour period?”

His answers, delivered in Montgomery County Circuit Court on Tuesday, were 40 years, 45 years and 50 years.

Their sentences concluded the prosecution of a band of five intruders. McGann said all were culpable.

“This was a total, ruthless team enterprise,” the judge said.

He called the victims “a hard-working, salt-of-the-earth extended family, living in a modest, two-bedroom apartment’’ with four adults from 36 to 64 and the boy.

Posing as house painters, the intruders arrived at the apartment the evening of Aug. 1, 2017, and convinced the residents they were there to take measurements and talk about possible repairs they’d been sent to check on, testimony showed. The family let them in but quickly grew suspicious.

According to testimony, one intruder began counting down: 5, 4, 3, 2 . . . before they attacked. The victims’ hands were bound. The boy was kept in a bedroom.

“They wanted fast money,” Montgomery County Assistant State’s Attorney Mark Anderson said in court Tuesday.

The attackers pulled knives and demanded the manager of the check-cashing store give them the keys and codes, according to court testimony. They threatened to cut out her eye and kill her son.

The attackers got the keys to the store’s front door and codes to a safe, and two headed to the business, according to court records. The pair made it through the front door, tripped a security alarm, and fled — back to the apartment.

Two of them then returned to the business, this time with the manager in tow. As the three got close, though, they could see people outside the building, so they returned again to the apartment.

But in the meantime, unknown to the attackers who had fled the store, the alarm had drawn police to the business. A regional manager of the check-cashing chain had ordered that the front door be barred.

One of the intruders went back a third time to the store, again bringing the manager as other intruders held her family captive at the apartment. Seeing the barred door, he realized he could not get in and headed back to the apartment.

Night had turned to morning, and by about 8 a.m., the woman’s husband, a 40-year-old delivery man, was still handcuffed at the apartment — but with his hands in front of him.

One of the intruders attacked him with a large, folding knife.

“What are you doing?” the man asked, according to his testimony.

The attacker told him to shut up, slicing the man’s neck.

The man fought back, knocking away the knife from the attacker. Another intruder then handed the attacker a butcher knife, according to court records. But the victim managed to wrest control of that knife, all while handcuffed, according to court records.

The intruders fled. The police were called.

“You’re a brave man,” McGann said to the husband, who was in court Tuesday. “You fought back. You defended yourself and your family.”

Anderson, the prosecutor, said outside court that he was amazed by how well the victims have held up. “The resilience of that family is very inspirational.”

The three intruders sentenced Tuesday were convicted after a trial earlier this year: Bobby Johnson, 27, who got 40 years; Karon Sayles, 26, who got 45 years; and Dalik Oxely, 20, who got 50 years. Oxely received the longest sentence because he slashed the man’s neck, McGann said.

In previous proceedings, Younus Alaameri, 25, described in court records as the mastermind of the plan, got 30 years after pleading guilty. Edwin Ajeo, 18, got 10 years after pleading guilty and testifying in the trial of the three sentenced Tuesday.

Read more: