MANILA, Philippines (AP) — After lashing out at longtime ally America, the new Philippine president is making a state visit to China in a charm offensive that will help define how far he wants to shift allegiance from treaty ally the US to an Asian superpower locked in a territorial standoff with his small, impoverished country.

It's a high-stakes gamble for brash President Rodrigo Duterte.

While he recalibrates Philippine relations with the world's big powers, his country's 65-year alliance with the United States — a key pillar of President Barack Obama's rebalance to Asia — hangs in the balance. China will likely move to regain lost ground in a Southeast Asian nation that won a major arbitration lawsuit against Beijing's massive territorial claims in the South China Sea just three months ago.

Below is a look at some of the issues surrounding Duterte's four-day visit to China that begins Tuesday and will include meetings with President Xi Jinping and other officials.

WHY IS DUTERTE PURSUING A MAJOR FOREIGN POLICY SHIFT AND WHAT DOES HE WANT FROM CHINA?

Duterte's desire to chart a foreign policy independent of the United States apparently stems from a variety of reasons, including the history of American colonialism in the Philippines. He was also angered by a 2002 incident in which he accused FBI agents of spiriting out of the country an American blamed for a hotel room blast in Davao city, where Duterte served as longtime mayor. More recently, he has told Barack Obama "to go to hell" in a speech after the US president criticized his deadly anti-drugs crackdown. He has declared plans to scale back engagements with US forces whose presence, he said, has inflamed Muslim restiveness in the south and has failed to help uplift his country's anemic military.

"I am not a fan of the Americans," he said last month.

Duterte wants to make progress on the South China Sea territorial dispute between the two countries and expand defense cooperation with China, which could be a new source of weapons for the Philippines.

WILL DUTERTE RAISE THE THORNY SOUTH CHINA SEA DISPUTES IN CHINA?

Before embarking on his trip to Brunei and China, Duterte said the territorial conflicts would be taken up, including a July 12 decision by an international arbitration tribunal that invalidated China's claim, based on historical grounds, to virtually the entire South China Sea. While he pledged he would "not bargain" over Philippine sovereignty and stick to his country's claims, Duterte said "there will be no hard impositions."

In his outreach to China, Duterte says he primarily wants Filipino fishermen to regain access to Chinese-held Scarborough Shoal in the South China Sea that both sides claim, and boost trade and investment after years of frigid relations. It's been suggested that he might seek China's assurance that it will halt any more island-building plans in disputed areas.

A few days before his state visit to China, the two sides still haven't agreed on proposed paragraphs concerning the disputes in a joint statement that may be issued at the end of Duterte's visit in Beijing, according to a Philippine official privy to efforts to draft the statement.

WHAT IS THE US ATTITUDE TOWARD DUTERTE'S BOOSTING RELATIONS WITH WASHINGTON'S KEY ASIAN RIVAL?

The US says it wants to see better relations between the Philippines and China, wary that any major downturn could harm regional stability and possibly force the Washington to take action under its 1951 mutual defense treaty with the Philippines. Yet, it doesn't wish for that to come at the expense of its relations with Manila, and a marked deterioration of ties would likely be viewed with alarm, since the Philippines remains a key part of the US chain of alliances in Asia running from Japan and South Korea to Australia.

Any effort by Duterte to enhance defense ties with China will also likely unsettle the US military if it feels the security of American military personnel and operations could be compromised.

Connections between the US and the Philippines run deep, represented in their century-old relationship and the more than 3 million Americans of Filipino descent. Such links are likely to ensure that relations remain close, no matter what direction foreign policy takes under Duterte.

China's relations with its neighbors, meanwhile, often stagger from crisis to crisis, raising the possibility that the next dust-up over the South China Sea could result in new economic or diplomatic retaliatory measures from Beijing. In such a case, the US will be likely standing by, eager to remind Manila of who its true friend is.

WHAT DOES CHINA HOPE TO GET OUT OF THE VISIT AND ANY CHANGE OF COURSE BY DUTERTE?

While China has expressed openness to Duterte's efforts to boost trade and seek financing for railways and other infrastructure, it remains uncertain if China will back away from its longstanding South China Sea sovereignty claims, including at Scarborough, where the Chinese coast guard continues to block Filipino fishermen.

China would be expected to applaud any diminishing of US influence among Asian nations since that creates more room for it to increase its economic, political and military influence. Beijing was caught off guard by the US "pivot" to Asia — of which stronger ties with the Philippines was a key element — so a change of course by Manila serves Beijing's goal of negating Washington's bid to shore up its influence.

Beijing is also eager to consign the Hague arbitration panel's ruling to history and resume its approach of discussing territorial disputes on a bilateral basis with the countries concerned. The ruling bore the spirit of multilateralism that would reduce China's relative heft vis-a-vis the other claimant countries and brought the sort of outside intervention that Beijing has long condemned.

Finally, warmer ties with the Philippines might also provide opportunities for the Chinese economy, particularly the newly established Asian Infrastructure Investment Bank that Beijing has backed as an alternative to the Asian Development Bank, the International Monetary Fund and other global financial institutions. Chinese companies would move aggressively to snap up any major infrastructure projects that become available, especially road and rail construction.