A Japanese court has ruled that Prime Minister Junichiro Koizumi's visits to a controversial war shine violate the constitution.
Koizumi says he goes to the shrine to pray for peace
Government officials are banned from "religious activity" which contravenes the separation of state and religion.
But Mr Koizumi argues his visits to the shrine, which honours Japanese war dead including war criminals, are private.
The controversial visits have strained Japan's already tense relationship with China and South Korea.
It is not clear if the ruling can stop the prime minister, who has visited the shrine four times since taking office in 2001, from going there in future.
When a similar verdict was handed down by Fukuoka District Court in April 2004, Mr Koizumi said he would continue to visit the shrine.
The Osaka High Court said the visits were unconstitutional but rejected compensation claims from 188 mainly Taiwanese relatives of WWII veterans.
They claim they are suffering mental distress because their loved ones who were conscripted by Japan are enshrined there alongside Japanese soldiers.
There have been several such cases processed by the Japanese courts, most of which fail.
On Thursday, the Tokyo High Court threw out an appeal related to a similar case, saying the prime minister had worshipped at the shrine as a private citizen.
China, South Korea and other Asian countries see the controversial shrine as a symbol of Japan's past militarism.
But Mr Koizumi insists he only wants to honour the millions of Japanese killed in the war and to pray for peace.
Mr Koizumi was last seen at the shrine in January 2004, but after his recent re-election many believe another visit is imminent.