MANILA (Reuters) - Diplomats in the Philippines are in talks with counterparts in Japan and China to arrange visits by controversial President Rodrigo Duterte at the end of next month, officials in Manila said on Friday.

Philippine President Rodrigo Duterte raises a middle finger thrust out in an obscene gesture as he speaks before local government officials in Davao city, in southern Philippines, September 20, 2016. Picture taken September 20, 2016. REUTERS/Lean Daval Jr

Dates were still being worked out for the proposed trips by the outspoken leader, several officials said, remaining anonymous because they were not authorized to speak to media.

A Japanese foreign ministry official confirmed plans were being made. China’s Foreign Ministry did not confirm the trip, but reiterated its invitation for Duterte to visit “at an early date”.

The Philippines’ relations with Japan are warm but those with China have long been frosty over territorial wrangles in the South China Sea.

Duterte has repeatedly said conflict was pointless and he wants to get along and do business with Beijing.

Some analysts believe Duterte’s uncharacteristic verbal restraint toward China, in contrast to his stinging rebukes of the United States, United Nations and European Union, shows he is hedging in pursuit of his goal of an independent foreign policy and reducing reliance on former colonial ruler Washington.

Duterte has lashed out against Washington, the EU and the United Nations for criticizing his deadly anti-drugs campaign, in which nearly 3,000 people have been killed.

China and the Philippines are trying to find a way to break the ice after a verdict by an arbitral court in The Hague in July invalidated China’s claims to most of the South China Sea and gave Manila the legal high ground in the dispute.

During a speech on Thursday, Duterte said he would go to China this year and, without elaborating, told Chinese businessmen: “You will see me often”.

He reiterated he would not deviate from the court ruling but would seek a way out of a four-year deadlock at the disputed Scarborough Shoal in the South China Sea and for China’s coastguard to let Filipinos fish there unimpeded. The arbitration panel ruled that no one country can legally control the shoal.

“China has already said several times that it welcomes President Duterte to visit China at an early date,” Chinese Foreign Ministry spokesman Lu Kang told reporters at a regular briefing.

“As long as both the Philippines and China continue to maintain the political will to reconcile our differences, there are no obstacles that cannot be overcome,” Lu said.

A source in Duterte’s office said it was possible former president Fidel Ramos, his new China envoy, could visit as early as next week to lay the groundwork for talks.

The relationship with Japan is far less complicated and Tokyo has agreed to provide 10 coastguard vessels to Manila to support its maritime security efforts.

Japan, a major investor across Southeast Asia, has been providing coastguard training and ships also to Vietnam, another country at odds with China over its maritime assertiveness.

The proposed October visits would be among Duterte’s first as president in what has been a colorful, at times dramatic first three months in office.

He attended a summit of Asian leaders in Laos earlier this month and has been to Indonesia. He is due to visit Vietnam next week.