JEDDAH, Saudi Arabia (AP) — Before stepping foot in Saudi Arabia, President Joe Biden knew there would be trouble.

Biden was risking criticism by visiting a country he had vowed to make a “pariah” for human rights abuses, and there was no guarantee the visit would immediately yield higher oil production to offset rising gas prices.

He decided to face the blowback anyway, hoping to use the visit to repair strained ties and make clear to wary Arab leaders that the United States remains committed to their security and the region’s stability.

His visit to Saudi Arabia was occasionally uncomfortable but, in Biden’s view, ultimately necessary. Although he’s been focused on confronting Russia’s invasion of Ukraine and limiting China’s expanding influence in Asia, those goals become far more difficult without the partnerships that he was tending to here.

“It is only becoming clearer to me how closely interwoven America’s interests are with the successes of the Middle East,” the president said Saturday at a summit in the Red Sea city of Jeddah.

It was a belated recognition of geopolitical reality that, for nearly a century, has kept the United States deeply invested in the energy-rich region, most recently with ruinous wars that stretched over two decades. Biden tried to turn the page on those conflicts while insisting that the U.S. would remain engaged.

“We will not walk away and leave a vacuum to be filled by China, Russia or Iran,” Biden said. “We will seek to build on this moment with active, principled, American leadership.”

The summit, where Biden announced $1 billion in U.S. funding to alleviate hunger in the region, was the final destination on Biden’s four-day trip, which included stops in Israel and the West Bank.

His travels were shadowed by a steady stream of grim news from Washington, where Democratic plans to address climate change floundered on Capitol Hill and there was fresh evidence that inflation had reached historic levels.

And at every step along the way, Biden confronted a far different region than existed when he served as vice president.

President Donald Trump withdrew from the Iran nuclear deal reached under President Barack Obama, and Tehran is believed to be closer than ever to building a nuclear weapon.

The threat, which Biden has struggled to address through renewed negotiations, has deepened coordination between Israel and its Arab neighbors, who have found common cause in confronting Iran.

The budding ties have also opened the door to greater economic and security integration, recasting the Middle East’s fractious politics at the same time that Arab leaders were fearing the U.S. had become a less reliable ally. They distrusted Obama’s outreach to Iran and Trump’s erratic behavior, then viewed Biden as neglectful toward the region once he took office.

Biden’s challenge has been to recognize the shifting landscape and persuade leaders in the Middle East to remain aligned with U.S. interests — without being dragged back into a corner of the world that the American public has largely turned away from after the end of wars in Iraq and Afghanistan.

Although Biden expressed a renewed commitment to the region by saying “the United States is not going anywhere,” he also seemed to acknowledge its limitations.

“The United States is clear-eyed about the challenges in the Middle East and about where we have the greatest capacity to help drive positive outcomes,” he said.

Besides announcing the new funding for hunger relief, he met individually with several of his counterparts, some for the first time since he became president.

He also invited Sheikh Mohammed bin Zayed Al Nahyan, who recently became president of the United Arab Emirates, formalizing his role at the helm of major policy decisions, to visit the White House in the coming months.

It was another effort to smooth ties that have become strained, in part because of Biden’s actions. For example, although the U.S. has played a key role in encouraging a monthslong cease-fire in Yemen, the Emiratis have criticized his decision to reverse a Trump-era move that had listed the Iran-backed Houthis as a terrorist group.

The centerpiece of Biden’s outreach in the Middle East was his first meeting with Crown Prince Mohammed bin Salman, the de facto ruler of Saudi Arabia and heir to the throne held by his father, King Salman.

The encounter began Friday with a fist bump outside the royal palace in Jeddah, a chummy gesture that was swiftly criticized because of Prince Mohammed’s history of human rights abuses. In addition to cracking down on his critics in Saudi Arabia, the prince, according to U.S. intelligence, likely approved the killing of the journalist Jamal Khashoggi nearly four years ago.

Biden rejected the notion that he was abandoning human rights by meeting with the crown prince, and said he brought up Khashoggi’s murder during their conversation. The topic created a “frosty” start to the meeting, according to a U.S. official who was not authorized to discuss the private meeting and insisted on anonymity.

The Saudi-owned Al Arabiya news network, citing an unnamed Saudi source, reported that Prince Mohammed responded to Biden’s mention of Khashoggi by saying that attempts to impose a set of values can backfire. He also said the U.S. had committed mistakes at the Abu Ghraib prison in Iraq, where detainees were tortured, and pressed Biden on the killing of Palestinian American journalist Shireen Abu Akleh during a recent Israeli raid on the West Bank city of Jenin.

The atmosphere between the two eventually became more relaxed, the U.S. official said, as they spoke about energy security, expanding high-speed internet access in the Middle East and other issues.

The regional summit in Jeddah and Biden’s visit provided Prince Mohammed with the opportunity to showcase his country’s heavyweight role in the Middle East, and his position at the helm of the world’s largest oil exporter.

He hinted that the kingdom could pump more oil than it currently does, something Biden wants to see when existing production quotas among OPEC+ member countries, which include Russia, expire in September.

“I’m doing all I can to increase the supply for the United States of America, which I expect to happen,” Biden said Friday. “The Saudis share that urgency, and based on our discussions today, I expect we’ll see further steps in the coming weeks.”

He also tried to draw Arab nations onto his side over the invasion of Ukraine by releasing satellite imagery indicating that Russian officials visited Iran in June and July to see weapons-capable drones that it could acquire.

The disclosure appeared aimed at drawing a connection between the war in Europe and Arab leaders’ own concerns about Iran.

So far, none of the countries represented at the summit has moved in lockstep with the U.S. to sanction Russia, a foreign policy priority for the Biden administration. If anything, the UAE has emerged as a sort of financial haven for Russian billionaires and their multimillion-dollar yachts. Egypt remains open to Russian tourists.

Meantime, there are sharp divisions on regional foreign policy among the heads of state who attended the summit.

For example, Saudi Arabia, Bahrain and the UAE are trying to isolate and squeeze Iran over its regional reach and proxies. Oman and Qatar have solid diplomatic ties with Iran and have acted as intermediaries for talks between Washington and Tehran.

But before ending his speech at the summit, Biden expressed hopes for a new era of cooperation.

“This is a table full of problem solvers,” he said. “There’s a lot of good we can do if we do it together.”

___

Batrawy reported from Dubai, United Arab Emirates. Megerian and Miller reported from Washington. Associated Press writer Darlene Superville in Washington contributed to this report.