UNITED NATIONS >> President Joe Biden declared in his final address to the U.N. General Assembly on Tuesday that the U.S. must not retreat from the world, as Israel, Hamas, and Hezbollah militants in Lebanon edged toward all-out war and Israel’s bloody operation in Gaza neared the one-year mark.

Biden used his wide-ranging address to speak to a need to end the Middle East conflict and the 17-month-old civil war in Sudan and to highlight U.S. and Western allies’ support for Ukraine since Russia invaded in February 2022. He also raised concern over artificial intelligence and its potential to be used for repression.

His appearance before the international body offered Biden one of his last high-profile opportunities as president to make the case to keep up robust support for Ukraine, which could be in doubt if Republican former President Donald Trump defeats Democratic Vice President Kamala Harris in November. Biden insisted that despite global conflicts, he remains hopeful for the future.

‘Sweep of history’

“I’ve seen a remarkable sweep of history,” Biden said. “I know many look at the world today and see difficulties and react with despair but I do not.”

“We are stronger than we think” when the world acts together, he added.

Biden came to office almost four years ago promising to rejuvenate U.S. relations around the world and to extract the U.S. from “forever wars” in Afghanistan and Iraq that consumed American foreign policy over the last 20 years.

“I was determined to end it, and I did,” Biden said of the Afghanistan exit, calling it a “hard decision but the right decision.” He acknowledged that it was “accompanied by tragedy” with the deaths of 13 American troops and hundreds of Afghans in a suicide bombing during the chaotic withdrawal.

But his foreign policy legacy may ultimately be shaped by his administration’s response to two of the biggest conflicts in Europe and the Middle East since World War II.

“There will always be forces that pull our countries apart,” Biden said, rejecting “a desire to retreat from the world and go it alone.” He said, “Our task, our test, is to make sure that the forces holding us together are stronger than the forces pulling us apart.”

On the Middle East

“Full scale war is not in anyone’s interest,” Biden said, and despite escalating violence, a diplomatic solution is the only path to peace.

Biden reiterated his call on the parties to agree to a cease-fire and hostage release deal, saying it’s time to “end this war” — even as hopes for such a deal are fading as the conflict drags on.

On Ukraine

Biden, in his address, called for the sustainment of Western support for Ukraine in its war with Russia. Biden helped galvanize an international coalition to back Ukraine with weapons and economic aid in response to Russian President Vladimir Putin’s February 2022 assault on Ukraine.

“We cannot grow weary,” Biden said. “We cannot look away.”

Biden has managed to keep up American support in the face of rising skepticism from some Republican lawmakers — and Trump — about the cost of the conflict.

At the same time, Ukrainian President Volodymyr Zelenskyy is pressing Biden to loosen restrictions on the use of Western-supplied long-range missiles so that Ukrainian forces can hit deeper in Russia.

Putin has warned that Russia would be “at war” with the United States and its NATO allies if they allow Ukraine to use the long-range weapons.

Biden and Harris are scheduled to hold separate meetings with Zelenskyy in Washington on Thursday. Ukrainian officials were also trying to arrange a meeting for Zelenskyy with Trump this week, though a Trump campaign official said it wasn’t going to materialize.

Other issues

The president also sounded an alarm about the rapid advances in artificial intelligence development, particularly around disinformation, respect for human life and the potential exploitation by totalitarian powers. He told the world leaders, “There may well be no greater test of our leadership than how we deal with A.I.”

“We must make certain that the awesome capabilities of A.I. will be used to uplift and empower everyday people, not to give dictators more powerful shackles on the human spirit,” he added.

Later, he held a bilateral meeting with U.N. Secretary-General Antonio Guterres and joined other world leaders in an event highlighting their partnership to combat the production and distribution of synthetic opioids like fentanyl, which drive tens of thousands of deaths in the U.S. annually alone.

Biden struck a wistful tone in his remarks, peppering his speech with references to his first time attending the General Assembly more than 50 years ago, and quoting Irish poetry.

Biden held up his decision to step aside up as an instructive moment as he addressed a gathering that has no small share of totalitarian and nondemocratic leaders.

“Some things are more important than staying in power,” Biden said. “It’s your people that matter the most. Never forget, we are here to serve the people. Not the other way around.”