SCRANTON, Pa. — A former northeastern Pennsylvania judge has been ordered to spend 17 1/2 years in prison for his role in a kickback scheme that placed juvenile defendants in for-profit detention centers.

Michael Conahan also was ordered Friday to pay $874,000 in restitution for the racketeering conspiracy he pleaded guilty to last year. He was taken into custody immediately.

Conahan apologized to the juveniles who were sentenced to long terms in detention facilities by another former judge, Mark Ciavarella Jr. Prosecutors say the duo took bribes from builder of a pair of juvenile detention centers and extorted cash from the facilities’ co-owner.

Ciavarella was sentenced last month to 28 years in prison.

The Pennsylvania Supreme Court overturned about 4,000 juvenile convictions in the wake of the so-called “kids for cash” scandal.