Under the double-barred gateposts, by the entrance to the bow-backed bridge, a solitary figure was waiting. He was white-robed and bare-headed. He was about to make history.

The Shinto priest bowed deeply to the group of men and women who approached the most venerated shrine in Japan. They, too, were enrobed – in the rich gold-embroidered red and blue of Chinese Taoism, in glorious Hindu saris, in simple white Islamic tunics and shifts, in bright yellow Sikh scarves and turbans, in the austere cassocks of Scandinavian Lutherans, the cream vestments of African Catholics and the black and red academic robes of American Baptists.

At any time in the past 2,000 years, the job of the Shinto guardian of the Hiyokebashi bridge would have been to prevent such aliens from entering this holiest of Japan’s sacred places. But now he bowed deeply, twice, and welcomed them to enter.

Download the new Independent Premium app Sharing the full story, not just the headlines

History was made at Ise Jingu in many ways this month. The ancient shrine has been completely rebuilt from new wood, as it has been every 20 years since the seventh century. The rebuilding has attracted a record 14 million visitors. Yet that is only part of a remarkable resurgence of Japan’s ancient religion of Shintoism, which, in the decades after the Second World War, had reached a low point unprecedented in its 3,000-year history.

That revival has produced a new Japanese openness to the wider world. It has welcomed in representatives of the faiths of foreigners including even the Confucians and Taoists of the two great religious traditions of Japan’s historical enemy, China. Shintoism this month also hosted the first international conference in its entire history. And it has developed a new attitude to a world threatened by climate change and environmental degradation.

So much so that the United Nations chose the conference as a forum to invite the world’s religions to help to shape the global debate on the social, political and economic yardsticks that will replace the Millennium Development Goals (MDGs) when they run out next year. The conference was named “Tradition for the Future” and its brief was to discover “culture, faith and values for a sustainable planet”.

The rebuilding of the Ise shrine is a potent symbol of that – for a paradox lies at its heart. Every 20 years, the shrine buildings are totally demolished and replaced with entirely new ones. It is thus a symbol of both change and continuity. The 20-year cycle allows ancient traditions in forestry and carpentry, thatching and weaving, metalwork and leather skills to be passed on from one generation to the next in an unbroken line. This is not a mere ritual. It is a practical necessity. Over two decades, 100 million people will cross the bridge, wearing it away to half its 6in thickness in the course of its lifespan. Those rebuilding the bridge have inherited the skills of boat carpenters practised in fitting together the floor of the bridge so that it is resistant to rain.

Shintoism is an unusual religion. It has no creeds or dogmas, no doctrines or scriptures. It is rooted in an animist belief that spirits or deities, kami, reside in objects throughout the natural world – rocks, rivers, waterfalls, mountains – as well as in animals and people, and that the spirits of the ancestors live on in the places in which they once dwelt. There are 80,000 shrines to such spirits throughout Japan.

But Ise Jingu is special. This is the shrine in which it is believed the spirits of the Japanese imperial family’s ancestors are enshrined, dating back, legend has it, to the sun goddess Amaterasu, from whom the emperors claimed descent. After each rebuilding, these imperial deities are transferred to a new dwelling – in a ceremony which takes place at night so that profane eyes may not view the sacred objects in which the spirits reside. In this relocation, it is believed, the deities renew their power in a way that rejuvenates the strength of the whole nation.

Religion and politics have long been intertwined here but at no time more so than when Japan’s emperor in 1868 – in an attempt to end the old feudal shogun warlord culture and replace it with the thriving political and industrial models of Western Europe – created State Shinto to unite the nation. Shintoism was purged of the “alien” Buddhist influences with which it had coexisted since the sixth century. Buddhist symbols and monks were expelled, many of the statues ending up in the British Museum thanks to the intervention of a far-sighted British diplomat.

Daily coronavirus briefing No hype, just the advice and analysis you need Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive morning headlines Monday - Friday plus breaking news alerts by email Update newsletter preferences

This marriage of animism and ancestor worship found its high point in Ise. Shintoism became an imperial cult in which all Japan was compelled to venerate the emperor – a state of affairs that persisted until the Japanese were defeated in the Second World War and the Americans forced Emperor Hirohito to go on radio to declare to the nation that he was no longer a god.

In the years that followed 1945, the old religion became discredited. All the more so after ultra-nationalist Shinto priests enshrined even the spirits of Japanese war criminals at the Yasukuni shrine of the war dead. Socialism began to replace Shintoism for modern Japanese. By 1998, the numbers visiting Ise had dipped below six million a year.

But then things began to change. The next generation had grown up without the demoralisation and guilt that the war had brought. Emperor Hirohito died in 1989 and, because the date changes in Japan with the advent of a new emperor, the feeling of a new era dawned. The events of the 1990s only compounded that: Japan’s property bubble burst, leading to a long decade of deflation and stagnation. The old Shinto traditions, with their simplicity and piety, seemed an antidote to the failed consumerist materialism of the Japanese Dream. Unable to afford foreign holidays, people stayed at home and pilgrimages to the ancient shrines revived. At Ise, the numbers climbed, to eight million after the 2011 Japanese earthquake and tsunami, and to 14 million this year.

The ritual of transferring the sun goddess to a new shrine building is part of that. But there is something more. In 2000, Shinto representatives attended a conference of the Alliance of Religions and Conservation in Kathmandu. There they had a revolutionary epiphany. They declared that they now realised that spirits and deities did not reside just in natural phenomena in Japan, but all over the world. Shinto has joined the global ecology movement.

The acceptance of Shinto into the alliance of world religions prompted the United Nations to piggy-back on this month’s event in Japan to have some faith input into the Sustainable Development Goals, which it is hoped world leaders will sign at the UN General Assembly in September 2015. The Sustainable Development Goals are to succeed the Millennium Development Goals, which were the benchmarks for international attempts to reduce poverty in the developing world since 2000. They expire at the end of next year.

The Sustainable Development Goals are a good deal more ambitious than the Millennium Development Goals, which applied only to poor nations, and succeeded in some countries more than in others. The new benchmarks will cover all nations and include targets for curbing climate change with a rising world population. They will be more expensive and harder to agree on.

The UN has decided that the world’s religions can help here. It flew its Assistant Secretary General, Olav Kjorven, out to Japan to tell religious leaders that the shortcomings of the Millennium Development Goals were in part due to the fact that they had been drafted by technocrats and economists, whose focus was narrowly materialist.

The faith leaders will have some time to offer their input. But their initial responses were instructive. Some were uncompromisingly austere. “It’s about greed versus nature,” said one of the Chinese Taoist masters, Lei Gaoyi. “We need to stop taking carbon that’s taken hundreds of millions of years to create and spewing it into the atmosphere, upending the delicate balance that Taoism teaches us is required for humanity to flourish.”

This was an interesting take from someone from the country which is the largest producer of greenhouse-gas emissions in the world. But it may be a sign that things could yet change, even in China. Ren Xuehua, 23, a Chinese Buddhist, confided that there were many among the children of the country’s affluent entrepreneur class for whom material prosperity had not brought happiness. She was at the conference with her father, Ren Ping, a Confucian, who is the chief executive of a £500m hydroelectric company. “Young people now want values,” she said.

The UN may be looking for more than values. It wants help from religion with implementation. That is a realistic expectation. “Some 75 per cent of Kenya’s schools are run by churches or faith groups,” said Abdalla Kamwana of the Supreme Council of Kenya Muslims. “If the religions had been involved in devising the MDGs, they would have been better delivered,” agreed Bishop Frederick Shoo, of Tanzania.

Dr Husna Ahmad, the Secretary General of the World Muslim Leadership Forum, said: “The UN needs a global workforce of volunteers who are altruistic, and passionate about saving our blessed planet for future generations.”

“Faith leaders have the trust of the people,” added Bishop Nathan Kyamanywa, of Uganda. “What a religious leader says has weight.”

This is not just talk. Religious leaders involved with the Alliance of Religions and Conservation have, for more than a decade, been running major projects to improve farming, land management, health and sanitation, and to curb the illegal wildlife trade. But religion has more to offer than mere delivery. The chief shortcoming of the Millennium Development Goals was that “they lacked passion”, said Bishop Walter Thomas, a US Baptist, “they were just tasks on a tick-list”. Faith, said the Kenyan environmentalist Dorcas Otieno, “would’ve put emphasis on attitudinal and moral change.”

The rebuilding of the Ise shrine offers a living symbol of that. Each 20-year renewal needs centuries of preparation, and takes eight years to complete. More than 12,000 cypress logs are required, many of a thickness which requires them to be around 200 years old. The wood for the columns on either side of the shrine, 4.5ft in diameter, is from trees some 400 years old.

The last time any timber was taken from the shrine precincts was in 1391. Eight hundred years of deforestation followed. Wood had to be imported from elsewhere. But in 1923, Shinto’s Shrine Precincts Preservation Committee set up a 200-year plan for replanting the shrine’s own forests. It will be another 120 years before most will be ready to be used. But this year, for the first time, around 20 per cent of the smaller trees used in the rebuild came from the replanting.

Perhaps ancient religions have a lesson to teach the rest of the world. If they have not left it too late.