TOKYO (Reuters) - Philippine President Rodrigo Duterte sought to assure Japan on Wednesday that his high-profile visit to China last week was about economics, not security, and vowed to stand on Tokyo’s side over the disputed South China Sea when the time came.

Earlier in the day, Duterte reiterated his harsh words for long-time ally Washington, saying he might end defense treaties.

The volatile Philippine leader’s visit to Japan comes amid jitters about his foreign policy goals after weeks of verbal attacks on ally the United States and overtures toward China.

Duterte last week announced in China his “separation” from the United States, but then insisted ties were not being severed and that he was merely pursuing an independent foreign policy.

His perplexing comments pose a headache for Japanese Prime Minister Shinzo Abe, who has tightened ties with Washington while building closer security relations with Manila and other Southeast Asian countries as a counter-weight to a rising China.

“You know I went to China for a visit. And I would like to assure you that all there was, was economics. We did not talk about arms. We avoided talking about alliances,” he told an audience of Japanese businessmen.

Duterte, speaking through a Japanese interpreter at the start of his talks with Abe, later said he would stand on Japan’s side in the contentious matter of the South China Sea.

Describing Japan as a “special friend who is closer than a brother”, Duterte said after the meeting that Manila would work closely with Japan on regional issues of common concern and uphold the values of democracy, the rule of law and peaceful settlement of disputes including the South China Sea.

Reading from a statement, he added: “Today we have taken steps to ensure that our ties remain vibrant and will gain greater strength in the years to come.”

INDEPENDENT FOREIGN POLICY

Both Tokyo and Washington have grown worried that the commitment under Duterte’s predecessor, Benigno Aquino, to stand up to China in the South China Sea is under threat, although Japan has no direct territorial row with Beijing there.

Japan has a separate dispute with China over tiny, uninhabited isles in the East China Sea, and has been keen to stress the importance of the rule of law.

Abe, for his part, said he welcomed Duterte’s efforts to improve Manila’s ties with Beijing and - noting the South China Sea issue was one of international interest - said the two leaders had agreed on the importance of settling maritime disputes peacefully.

Slideshow ( 14 images )

Aquino angered China by lodging a case with an arbitration court in the Hague challenging the legitimacy of Beijing’s maritime claims in the resource-rich sea. The court’s ruling in July emphatically favored Manila but was rejected by China, which has warned Washington and Tokyo to stay out of the feud.

Duterte earlier told an audience of Japanese business executives he did not pick quarrels with his neighbors, but had tough words for Washington.

“I have declared that I will pursue an independent foreign policy. I want, maybe in the next two years, my country free of the presence of foreign military troops. I want them out,” he said.

Slideshow ( 14 images )

“And if I have to revise or abrogate agreements, executive agreements, this shall be the last maneuver, war games between the United States and the Philippines military.”

China claims almost the entire South China Sea, through which about $5 trillion worth of trade passes every year. Brunei, Malaysia, the Philippines, Taiwan and Vietnam also have claims on the sea, believed to have rich oil and gas deposits.

Duterte has threatened to abrogate defense agreements with the United States several times but has yet to take any concrete action beyond cancelling some minor navy patrol exercises.

In a pattern already becoming familiar, Duterte’s foreign minister, Perfecto Yasay, tried to soothe concerns raised by the president’s remarks. He told a news conference that Manila would respect treaty obligations as long as mutual interests converged.

Japan and the Philippines also signed notes on two yen loan projects worth up to 21.4 billion yen ($205 million), including one to build two patrol boats for the Philippine Coast Guard to boost its capacity for search and rescue and law enforcement.