The problems began as soon as President Obama landed in China.

There were no stairs waiting for him to emerge from his usual door at the front of Air Force One.

On the tarmac, as Obama’s staffers scrambled to get lower-level stairs in place for him to disembark, White House press photographers traveling with him tried to get in their usual position to mark his arrival in a foreign country, only to find a member of the Chinese welcoming delegation screaming at them.

He told the White House press corps that they needed to leave.

A White House official tried to intervene, saying, essentially, this is our president and our plane and the media isn’t moving.

American and Chinese officials argued over where the White House press corps could stand at Hangzhou airport as President Obama arrived for the G20 summit. The Chinese official told the White House official, "This is our country. This is our airport." (Reuters)

The man yelled in response, “This is our country!”

The man then entered into a testy exchange with Obama’s national security adviser, Susan E. Rice, and her deputy, Ben Rhodes, while trying to block them from moving toward the front of the plane.

[Obama heads to Asia with his biggest foreign policy push hanging in the balance]

On what is probably his last visit to China, for a Group of 20 summit here, there were flare-ups and simmering tensions throughout — a fitting reflection of how the relationship between these two world powers has become frayed and fraught with frustration. Over the past seven years, strained ties with China have colored and come to define Obama’s foreign policy in Asia.

On Saturday, several White House protocol officers and other staff members arriving at a diplomatic compound ahead of Obama’s meetings were stopped from entering and had heated arguments with Chinese officials before they could get in.

“The president is arriving here in an hour,” one White House staffer was overheard saying in exasperation.

A fistfight nearly broke out between a Chinese official trying to help the U.S. diplomats and a Chinese security official trying to keep them out. “Calm down, please. Calm down,” another White House official pleaded.

President Obama praised the Paris agreement on climate change while meeting with world leaders at the G20 summit in China, but said the plan by itself "won't solve the climate crisis." (Reuters)

Twenty minutes before the arrival of Obama and Chinese President Xi Jinping, the two sides were still arguing in the room where the two leaders would soon be touting their cooperation. The Chinese insisted that there was not enough space for the 12 American journalists traveling with Obama. U.S. officials insisted that there was, pointing to a spacious area sectioned off for the media and citing arrangements negotiated long in advance.

For all the skirmishes, in the days leading up to the trip, White House officials gave a much rosier depiction of the U.S.-China relationship, talking up mutual efforts such as a deal to address climate change.

But in so many other areas, the world’s two largest economic powers have failed to bridge increasing hostilities and in­trac­table disputes over maritime issues, cybersecurity, trade and human rights. The yelling and screaming Saturday in many ways illustrated just how differently both sides view their roles — and how little has changed since Obama’s troubled first visit in 2009.

[How China’s ratifying the Paris climate deal could be bad for Donald Trump]

High hopes turn to pivot

Obama began with high hopes of improving U.S.-China relations. In 2009, he tried reaching out to Chinese leaders with offers of increased engagement. He decided not to meet with the Dalai Lama to avoid angering Beijing, to the disappointment of human rights advocates. Obama became the first U.S. president to visit China during his first year in office. But his administration was taken aback by how completely the Chinese controlled all aspects of that visit.

“He wasn’t allowed to say much at all,” said Orville Schell, a longtime China scholar who was in China during the visit. “The Chinese kept him from meeting certain people, from taking questions or even radio broadcasts. He didn’t know quite how to respond. He didn’t want to be impolite. It took the U.S. a while to understand that this was the direction China and the relationship was headed.”

Some have blamed Obama for adopting such an overly optimistic and open stance during those early years. For all his outreach, current and former top U.S. diplomats say, Obama got little in return, except the feeling of being burned by Beijing.

But that could be equally attributed to the simple fact that China itself was undergoing a seismic shift during the early years of Obama’s presidency.

When the global recession plunged the world into financial crisis in the late 2000s, China escaped unscathed. Its leaders looked around and realized for the first time just how much power China had achieved in ­becoming the world’s second-largest economy. Shortly there­after, they began eagerly throwing that weight around.

No longer were they willing to make concessions or bide their time — on big things, such as territorial claims, and on smaller ones, such as the nitty-gritty of negotiations over who sits where and says what during diplomatic exchanges.

Obama’s response to this newfound Chinese assertiveness was largely a response to reality. “In a textbook, it would be great to have a strategic vision for how you see things being eight years from now,” said Jeffrey A. Bader, Obama’s top Asia adviser during those early years. “But in this case, I think the word ‘reaction’ is right. You had a China that was changing in capacity and leadership.”

If the carrot of engagement didn’t work, Obama administration officials decided, they would try the stick. And they gave this tougher policy a name: the “pivot to Asia.”

The pivot boiled down to the idea of rebalancing U.S. ­foreign-policy attention from the Middle East to Asia — an area that will have clear long-term strategic importance in coming years.

Those overseeing the pivot strategy, senior U.S. officials said at the time, had studied examples in history when one power was rising while others were declining: Germany’s rise in Europe after World War I; Athens and Sparta; the rise of the United States in the 20th century.

Out of those studies, they developed a belief that China would respond best to a position of strength. To find that leverage, the United States planned to forge stronger ties with its traditional allies in Asia and pick up new allies among neighbors alienated by China’s new aggression — including Vietnam, Burma and India.

Using that multilateral approach, the thinking went, the United States could offset China’s rising military power and assertiveness.

Doubts among allies

The main problem with the Asia pivot was one of perception and substance.

European and Middle Eastern leaders expressed concern at the idea of U.S. attention and priorities suddenly shifting from their regions to another. Chinese leaders saw the pivot as a U.S. conspiracy to interfere with China’s goals and to slow its rise.

Meanwhile, the very Asian allies the pivot was meant to reassure had their doubts as well. Many wondered how much of the pivot was empty rhetoric and how much it would be backed by economic and military substance.

In recent months, those doubts have resurfaced because the ­Trans-Pacific Partnership — a multinational trade agreement with Asian allies that Obama hopes to enact this year — may die for lack of support in Congress and from presidential candidates Hillary Clinton and Donald Trump.

Meanwhile, in the years since the pivot strategy began, the U.S.-China relationship has soured.

Both countries are trying to avoid open hostility but are increasingly wary and frustrated with each other.

When asked about the skirmishes on this trip on Sunday, Obama said, “we don’t make apologies for pushing when it comes to press access.” But he added, some of the misunderstandings may just be due to the complicated logistics of hosting a G20 summit.

The U.S.-China relationship may be the biggest problem Obama’s successor will face in Asia. Other countries in the region continue to fear China’s rise but are not fully convinced that the United States will be a sufficient counterweight. How the next president deals with China — the exact proportion of carrots and sticks chosen and the Chinese response to that — will probably define the region in the decade to come.

If this visit by Obama is any indication, the situation is unlikely to improve anytime soon.

On Saturday, even as the two presidents finished their talk and prepared for a nighttime stroll toward Obama’s motorcade, Chinese officials suddenly cut the number of U.S. journalists who could cover them from six to three, and finally to one.

“That is our arrangement,” a Chinese official flatly told a White House staffer, looking away.

“But your arrangement keeps changing,” the White House staffer responded.

In the end, after lengthy and infuriating negotiations, they settled on having just two journalists witness the leaders’ walk.

Neither side was happy with the compromise.

David Nakamura in Washington contibuted to this report.

Read more:

Protests over black girls’ hair rekindle debate about racism in South Africa

Uzbek president’s death puts a new spotlight on the strange story of the country’s ‘jailed princess’

The Vatican believes Mother Teresa cured this woman. But was it a miracle?

Today’s coverage from Post correspondents around the world