Japanese Prime Minister Junichiro Koizumi has announced plans to withdraw his country's troops from Iraq.
Mr Koizumi said Japan's presence had been "highly appreciated by the Iraqi government and its people".
The 600 non-combat troops have been working on reconstruction projects in southern Iraq since February 2004, protected by UK and Australian forces.
The decision was unpopular with the Japanese public, many of whom said it violated Japan's pacifist constitution.
It was Japan's first foray into an active foreign war zone since World War II.
Japan's constitution currently renounces the use of force
This has been stretched to allow self-defence troops
1992 law allowed troops to join UN and relief work overseas
2003 law said troops could go to non-combat zones in Iraq
PM Koizumi wants to give Japan even greater powers
Drafted by the US in 1947, the constitution bans the use of force to settle international disputes. The troops in Iraq have been barred from using force except in self-defence.
Mr Koizumi said in a televised address that Japan would still provide "as much support as possible for the nation's reconstruction efforts".
The Japanese troops have been based in the city of Samawa, engaged in work such as repairing buildings and providing medical training.
Japanese media reports said the last troops were expected to leave by late July.
The decision to withdraw is likely to have been prompted by plans for the UK and Australia to hand over responsibility for security in the area around Samawa to Iraqi forces.
The Iraqi forces will take over Muthanna province next month, in what will be the first such handover since the US-led invasion.
Japan has gradually been expanding its role on the international stage in recent years.
It deployed nearly 1,000 troops to Indonesia to help with humanitarian aid following the December 2004 tsunami
But the deployment to Iraq - which began in late 2003 - drew criticism from many Japanese, who said it would be impossible for the troops not to get drawn into the fighting.
Mr Koizumi won warm praise for the deployment from US President George W Bush, but he was criticised at home for overriding the constraints of the constitution to serve his own political purposes.
No Japanese soldiers have been killed or wounded in Iraq, but Mr Koizumi faced a political crisis in 2004 when three aid workers were taken hostage by Iraqi insurgents, who demanded that Japanese troops withdraw.
The three were eventually released unharmed, but another five Japanese citizens have been killed by militants.
Mr Koizumi is due to visit President Bush at the end of this month. He is due to leave office later this year.