NEW YORK — For decades, Bill Cosby cast himself as America's dad and then as America's granddad, a moralist with tough talk for young people about acting responsibly. It was that image that proved to be his undoing. The judge who unsealed documents on Monday revealing Cosby's 2005 admission that he obtained quaaludes to give to young women before sex cited the comedian's public moralizing in deciding to release the testimony. The testimony, from a decade-old lawsuit, has called into question Cosby's denials that he drugged and sexually assaulted women. Cosby had fought the request from The Associated Press to unseal the material. But U.S. District Judge Eduardo Robreno in Philadelphia ruled: “The stark contrast between Bill Cosby, the public moralist, and Bill Cosby, the subject of serious allegations concerning improper (and perhaps criminal) conduct, is a matter to which the AP — and by extension the public — has a significant interest.” As leader of television's Huxtable clan in the 1980s, Cosby was the dad who did things right. It was a persona that made him beloved and rich. And Cosby gave back. He and wife Camille offered millions in donations to colleges and other institutions across the US, including $20 million to historically black Spelman College in 1988. He also freely gave advice and opinions on society's failings, which weren't welcomed as much as the donations. One such commentary, a decade ago during a commemoration of the 50th anniversary of the Supreme Court decision on segregated schools, was cited by Robreno in his ruling. Cosby criticized a lack of parenting among poor families, complaining about young people's poor speech, dress and dropout rates. Even before Monday's release of testimony, the allegations had severely damaged Cosby's career. NBC walked away from plans to make another Cosby sitcom, TV Land took reruns of “The Cosby Show” off the air, and Netflix shelved plans for a Cosby standup special. — AP