He had been sentenced to two years amid mass protests in a case seen as the test of Indonesia's religious tolerance.