Appeal court rules that the judge who sentenced the man to jail failed to give due consideration to the role of his Indigenous background