A sentence of nine months in solitary confinement given to Colin Ferguson, the Long Island Rail Road gunman, for encouraging his fellow state prison inmates to riot was upheld Thursday by the Appellate Division, Third Department.

The panel ruled unanimously that the misbehavior report filed by staff at Attica state prison, videotape and the testimony at his disciplinary hearing all provide “substantial” evidence of Ferguson’s guilt.

According to the misbehavior report, a guard said he heard Ferguson tell fellow inmates in the solitary confinement unit on Sept. 11, 2011, “I encourage all inmates to riot and kill prison guards.” Ferguson also urged prisoners to arm themselves, the report said.

The panel said in Ferguson v. Fischer, 517015, that it was within the discretion of the hearing officer at Ferguson’s disciplinary hearing to reject his denials of making the statements that threatened violence.

Ferguson was found guilty of rioting, violent conduct and making threats and sentenced to 18 months in solitary confinement and to lose privileges such as use of the commissary or telephone for 18 months. On appeal to state prison administrators, the 18-month confinement in solitary was reduced to nine months. The 18-month loss of privileges was upheld.

Justice John Lahtinen (See Profile), William McCarthy (See Profile), Robert Rose (See Profile) and John Egan Jr. (See Profile) joined in the unsigned ruling.

Ferguson, now 56, is serving a minimum 315-year sentence for killing six people and wounding 19 in a 1993 shooting rampage on a Long Island commuter train.