Indonesia's top court has overturned a law that denied recognition and legal rights to followers of indigenous faiths.

The Constitutional Court on Tuesday said articles in the 2013 Civil Administration Law were discriminatory and unjust.

The ruling is an unexpected advance for religious freedom in Indonesia at a time when religious conservatives have demonstrated growing political influence and undermined the country's reputation for tolerance.

The 2013 law effectively required followers of faiths not among the six recognized by the government to list one of the official religions on their national identity card or be denied basic rights such as marriage registration and land titles.

Indonesia, the world's most populous Muslim nation, recognizes Islam, Protestantism, Catholicism, Buddhism, Hinduism and Confucianism.

Millions also practice animism and other local faiths.