NEW YORK —  A judge in New York has ruled that royalties of convicted singer R. Kelly must be turned over to victims he sexually abused, according to court documents filed Wednesday.

The royalties amount to more than a half million dollars after Brooklyn prosecutors sought to garnish the Chicago native’s career earnings. In June, the US Attorney’s Office for the Eastern District of New York filed motions that asked a judge to order Sony and Universal Music Publishing Group to fork over any money preserved from R. Kelly’s music catalog.

According to the June 1 filing, the EDNY sought to use the garnished funds to pay outstanding penalties ($140,900) and restitution ($379,649.90) to two abuse victims after the court awarded them more than half a million dollars.

As of Wednesday’s garnishment order, the outstanding balance was $507,234.05. Prosecutors said that while that figure will fluctuate due to interest, Universal Music Group holds at least $567,444.19 in accrued funds.

Because the funds held by Universal will cover the entire restitution debt, the US Attorney’s Office will withdraw our Writ of Garnishment against Sony, prosecutors added.

Kelly is serving a total of 31 years in prison for racketeering and sex trafficking following his convictions in both New York and Chicago.