Image caption Japan-US ties have been strained over the future of the Okinawa base and troops

The United States and Japan have reached a deal to move thousands of US Marines from the island of Okinawa.

Some 9,000 marines will be sent to ''locations outside of Japan'', a joint statement by Washington and Tokyo said. Some 10,000 troops will remain.

The revised agreement comes ahead of a visit to Washington by Japanese Prime Minister Yoshihiko Noda.

The two sides have still not reached agreement on closing the controversial Futenma airbase on Okinawa.

The troops leaving Okinawa will be moved to Guam, Hawaii and other locations in the Asia Pacific region.

Japan has been unable to fulfil the conditions of an agreement over Okinawa signed in 2006 under which it had to find an alternative location for the Futenma air base before US troops were redeployed.

Proposed alternatives met heavy local opposition.

At the beginning of talks this year, both countries said they had agreed to de-link the two issues.

In the latest statement, they said they still agreed that Futenma should be relocated to Camp Schwab, in a sparsely populated area miles north of Naha, in line with the 2006 deal.

This "remains the only viable solution that has been identified to date", the two governments said.

OKINAWA TIMELINE 1429 : King Sho Hashi establishes Ryukyu kingdom

: King Sho Hashi establishes Ryukyu kingdom 1609: Satsuma clan from southern Japan invade

Satsuma clan from southern Japan invade 1872: Japan makes Ryukyu kingdom a feudal domain; absorbs it in 1879

Japan makes Ryukyu kingdom a feudal domain; absorbs it in 1879 1945: An estimated 100,000 Okinawan civilians die in Battle of Okinawa; Japan surrenders; US takes control of Okinawa

An estimated 100,000 Okinawan civilians die in Battle of Okinawa; Japan surrenders; US takes control of Okinawa 1972: Okinawa reverts to Japan; US bases stay Profile: Okinawa

The announcement is intended to take the sting out of the dispute before Mr Noda visits Washington next week, says the BBC's Roland Buerk in Tokyo.

'Balance of power'

The US presence on Okinawa island has long been controversial.

Locals on Okinawa say having the Futenma base near a city is dangerous and noisy and they want it removed from the island altogether.

Occasional well-publicised instances of bad behaviour and criminality by US personnel, including a 1995 rape of a 12-year-old girl by three US servicemen, have fuelled the concerns.

The issue has put a strain on the US-Japan security alliance, which both countries see as critical to maintaining the balance of power in Asia as China rises, says our correspondent.

Former Prime Minister Yukio Hatoyama promised to shift the base off the island, but he resigned in 2010 when he failed to get agreement on another location.

It remains unclear when the troops will be redeployed and when the Futenma base will be moved.

US Defence Secretary Leon Panetta said the US would now work with the Japanese Self Defense Force to ''implement these decisions''.

"Japan is not just a close ally, but also a close friend,'' he said. ''And I look forward to deepening that friendship and strengthening our partnership as, together, we address security challenges in the region."

The US has a total military deployment in Japan of about 50,000 personnel.