The high court erred in holding that the law was violative of the principle of secularism, said a bench comprising Chief Justice of India D Y Chandrachud and Justices J B Pardiwala and Manoj Misra.