KIEV, Ukraine — Former President Viktor F. Yanukovych committed treason by inviting Russia to invade Ukraine and reverse a pro-Western revolution that ousted him from power, a court in Kiev ruled on Thursday, sentencing Mr. Yanukovych to 13 years in prison.

The former president is a widely reviled figure in Ukraine for his over-the-top corruption — he lived in a palace with a private zoo — and because the police shot dozens of antigovernment demonstrators during an uprising in 2014. He has also been widely characterized in Ukraine and the West as pro-Russia — and even as a puppet of the Russian president, Vladimir V. Putin.

The court’s ruling was the first to formally determine that Mr. Yanukovych was serving Russian interests while president of Ukraine.