By Chris Hogg
BBC News, Tokyo
Japan's highest court has rejected an attempt to stop Prime Minister Junichiro Koizumi's visits to the controversial Yasukuni Shrine in Tokyo.
A number of war criminals are commemorated at Yasukuni
Mr Koizumi has made five visits to the shrine where Japan's war dead are honoured since taking office in 2001.
His visits have angered neighbouring countries, which say the shrine glorifies Japan's militaristic past.
The shrine honours 2.5m Japanese who died in military service, including criminals executed for war crimes.
The relatives of some of those who died in World War II, from Japan, China and South Korea, tried to argue that the prime minister's visits to the Yasukuni shrine caused them psychological distress.
They asked the court to rule whether Mr Koizumi's first visit five years ago was unconstitutional, violating the division between state affairs and religion.
Koizumi has visited the shrine five times since becoming leader
On that occasion, he arrived in an official car, accompanied by staff, and signed the visitors book as prime minister.
The court did not address that issue, but the judge said that whilst people might feel upset about Mr Koizumi's visits, it did not mean they could claim damages from him, and he threw out the lawsuit.
Over the years there have been a number of similar legal challenges in the lower courts.
For the most part ,attempts to win compensation have failed and the issue of constitutionality has been side-stepped.
Mr Koizumi, whose term of office will soon be over, made a promise to visit the shrine every year before he became prime minister.
While the visits anger China and South Korea, they play well with some of his supporters at home.
He is widely expected to visit one last time before he steps down in September.