Bill Cosby. (AP Photo/Matt Rourke, File)

Comedian Bill Cosby was targeted by a drone while he was in the yard of his Pennsylvania prison last week.

Cosby's spokesman Andrew Wyatt confirmed that the drone was spotted over the prison SCI Phoenix in Collegeville, Pennsylvania, where Cosby has been locked up since September 2018 after he was sentenced for almost 10 years for his conviction on three charges of sexual assault, reports usatoday.com.

Amy Worden, a press secretary in the Pennsylvania Department of Corrections, said the department does not discuss security matters.

"That said, the agency has installed drone detection systems as part of enhanced security measures at its prisons. Flying drones over prisons in Pennsylvania is against the law and the agency will work with law enforcement to prosecute perpetrators to the fullest extent of the law," Worden said.

According to TMZ, Cosby, who is 81 and legally blind, was being escorted around the yard when the drone flew over and guards spotted it.