Bill Cosby has been sentenced to between three and 10 years in prison over his conviction on a number of sexual assault charges.

Judge Steven O’Neill handed down the sentence at a Pennsylvania courthouse in Montgomery County on the second day of the sentencing hearing. Saying it was “time for justice”, Judge O’Neill also fined Cosby $25,000 (£19,000).

Cosby was denied bail and led out of the courtroom in handcuffs. His lawyers have said they will appeal the conviction, with Cosby having denied wrongdoing.

“This is a serious crime he was convicted for,” said Judge O’Neill. “This is a sexual assault crime.” The judge also said Cosby could “quite possibly be a danger to the community”.

Cosby, 81, was found guilty in April of three counts of aggravated indecent assault for the drugging and assault of his one-time friend Andrea Constand, a former Temple University administrator, at his Philadelphia mansion in 2004.

Judge O’Neill also decided to designate Cosby a “sexually violent predator” under Pennsylvania law. It means that Cosby will have to register as a sex offender with police for the rest of his life and attend monthly counselling sessions. Local schools and neighbours will be notified of his address and crimes.

Prosecutors had asked for the maximum prison sentence of between five and 10 years, citing the nature of Cosby’s crime as well as his alleged history of misconduct. They had also asked the judge to levy a $25,000 fine on Cosby and make him pay court costs. If ever he came up for parole, prosecutors wanted him to submit to a “psycho-sexual evaluation” that he had refused prior to sentencing.

Cosby’s lawyers had asked for house arrest rather than prison time, arguing that the legally-blind actor was too frail to be locked up..

Cosby was the first celebrity to be convicted for sexual abuse since the start of the #MeToo movement.

Another Cosby accuser in the courtroom, Lili Bernard, said: “There is solace, absolutely. It is his fame and his fortune and his phony philanthropy that has allowed him to get away with impunity. Maybe this will send a message to other powerful perpetrators that they will be caught and punished.”

Bill Cosby arrives at court for sentencing

Dozens of other women also have accused Cosby of sexual abuse going back decades, with Cosby having always maintained his innocence. Many of the allegations are too old to prosecute. The Constand case was the only allegation that led to criminal charges.

After the sentencing, Andrew Wyatt, Cosby’s spokesman, read a statement in which he said the entertainer had been subjected to “the most racist and sexist trial in the history of the United States”.

When asked what it meant to see Cosby leave the courtroom in handcuffs, prosecutor Kevin Steele said: “Look it’s not a cause for celebration and we take very seriously the taking of somebody’s liberty, but I will not apologise for our job, our job is to separate the predators from the good people in our community, and that happened today.”

On the first day of the hearing on Monday, Ms Constand said in a written statement submitted to the court that the attack had turned her into a woman who was “stuck in a holding pattern for most of her adult life, unable to heal fully or to move forward”.