The New Mexico Supreme Court has ruled that thousands of state workers covered by union contracts are owed back pay and raises totaling millions of dollars.

The state's highest court on Thursday affirmed a Court of Appeals' decision that says about 11,000 state workers are entitled to retroactive pay increases because former Gov. Bill Richardson's administration didn't follow union contracts in distributing money provided by the Legislature about five years ago.

Gov. Susana Martinez's administration has estimated the ruling will cost the state more than $20 million.