Derrick Cook was a familiar face in Northern Liberties, a 15-year-old who worked at a local store and sometimes did odd jobs for neighbors.

On Thursday, a score of those neighbors sat stunned as they heard a city prosecutor graphically describe two 2008 sexual assaults Cook admitted to, one in which he almost killed the woman.

Two hours later, Cook, now 17, was sentenced to 20 to 45 years in prison by a Philadelphia judge who railed against society's refusal to deal with conditions he said were producing "hundreds of thousands of future Derrick Cooks."

Cook, a chunky, baby-faced youth in a lime-green polo shirt and jeans, said nothing before Common Pleas Court Judge Benjamin Lerner sentenced him.

Defense attorney Alice Meehan said Cook was too nervous to speak and read his letter apologizing to his victims: "I am ashamed at what I did and I know the person who committed these crimes will not be the same person who comes out of prison."

Lerner said that after prison Cook would be on court supervision for five years and must register with police as a sexual offender under Megan's Law.

Lerner's sentence was far below the 80- to 160-year prison term requested by Assistant District Attorney Namratha Ravikant, who argued that one victim would have died if a pedestrian had not noticed her open door, investigated, and called police.

"Except for that man walking his dog, this would have been a murder," Ravikant said.

Lerner agreed, calling Cook's crimes "a form of murder. The victims in these cases have died in some degree or another."

But Lerner said a life term was not appropriate for a 17-year-old who pleaded guilty.

Lerner also cited Cook's childhood - a psychotic, drug-addicted mother who terrorized him and grandparents who did not seek help because they feared the boy might be taken from them.

That past was confirmed in testimony by Cook's tearful mother and maternal grandmother, and by Gregory Thompson, a program manager at the Philadelphia Industrial Correctional Center, where Cook has been imprisoned.

"He has been failed by his family," said Thompson, who told Lerner how far Cook had come during prison counseling. "More people should be going to jail today than just Derrick."

In 10 years of handling murder cases and cases of juveniles being tried as adults, Lerner said, "There is no end to the way in which adults charged with the care and raising of children can, either through ignorance, neglect, or evil motives, or personality failings, destroy those children's lives."

Ravikant said afterward she had hoped for a longer prison term because Cook "inflicted terror on these women that is still here today."

The first assault was Aug. 11, 2008, when Cook dragged a 23-year-old woman into an alley off the 800 block of Orkney Street, beat her, hit her in the head, and raped her several times.

Ravikant said Cook then stole her cell phone and used it to take photos of her nude body.

The woman was not in court but Ravikant read a letter in which she said the assault emotionally destroyed her, destabilizing her bipolar illness and making her so anxious she could not leave her apartment.

The woman lost her two secretarial jobs, a part-time cleaning job, her plans to attend college, and her apartment.

The victim wrote that she became homeless, moved to Pittsburgh, spent two weeks in a psychiatric hospital and two months as an outpatient.Cook subsequently exposed himself and tried to grab another woman. He was arrested and sentenced as a juvenile to electronically monitored house arrest.

On Nov. 23, 2008, Ravikant said, Cook cut his ankle monitor and went to the house of a 45-year-old graphic designer who sometimes paid him to do odd jobs.

Believing Cook's story that he had been locked out of his house, the victim let him inside to use the phone.

Ravikant said Cook then beat and stabbed her and forced her to perform a sex act "while she was bleeding out."

Cook left the house, returned to it to wash his hands in the kitchen near the woman's body, and walked out without closing the door.

The victim, her face scarred from the beating that crushed her cheek bone and damaged her left eye, said she has permanent double-vision, no depth perception, and can no longer work, drive, or perform routine chores.

The attack broke her neck and left her with limited use of her left arm and "pins and needles numbness" over 90 percent of her body.

"I can't even feel it when I pet my cat," said the woman, who broke into sobs and was embraced by a friend as she left the microphone.

Also in tears were many neighbors who had been encouraged to attend by the Northern Liberties Neighbors Association, which has seen the area go from urban frontier in the 1970s to a booming, hip home to young people drawn to developments like the Piazza at Schmidts.

Matt Ruben, a longtime Northern Liberties resident and activist and president of the neighborhood group, said he was in shock from what he had heard in court.

"I can't wait until this day is over," he said.

Contact staff writer Joseph A. Slobodzian at 215-854-2985 or jslobodzian@phillynews.com.