UNITED NATIONS -- President Obama promised the Libyan people that the world will stand with them as they reshape their country following the fall of Muammar Qaddafi's regime.
Speaking at a high-level United Nations meeting Tuesday, the president warned that there would still be difficult days ahead in Libya, as Qaddafi loyalists make a final stand and the country's provisional leadership grapples with the complex task of setting up a new government. But Obama said it was clear that Libya was now in the hands of the people.
"After decades of iron rule by one man, it will take time to build the institutions needed for a democratic Libya. I'm sure there will be days of frustration," Obama said. "But if we have learned anything these many months, it is this -- do not underestimate the aspirations and will of the Libyan people."
"Just as the world stood by you in your struggle to be free, we will now stand with you in your struggle to realize the peace and prosperity that freedom can bring," he said.
Obama praised the international community for having "the courage and the collective will to act" in Libya. He said that while global powers cannot and should not intervene every time there is an injustice in the world, there are occasions when nations must join forces to prevent the killing of innocent civilians.
"Our international coalition stopped the regime in its tracks and saved countless lives, and gave the Libyan people the time and space to prevail," Obama said.
Obama was joined at the meeting on Libya by several other world leaders and representatives of Libya's National Transitional Council. Prior to the gathering, Obama met one-on-one with the NTC's chairman, Mustafa Abdel Jalil.
The U.S. now recognizes the NTC as Libya's legitimate government. Obama announced Tuesday that the U.S. ambassador was heading back to Tripoli to lead a newly reopened American embassy there.
Obama called on Jalil and other NTC leaders to ensure a timely democratic transition in Libya, including free and fair elections.
While much of the focus is on Libya's political transition, serious security concerns remain. Small bands of Qaddafi supporters continue to fight in pockets around the country, and the longtime leader has yet to be captured.
Obama said the NATO-led bombing campaign in Libya will continue as long as civilians are threatened. And he urged Qaddafi loyalists to lay down their arms and join the new Libya, declaring, "the old regime is over."
Obama's remarks on Libya opened the first of his two days of meetings at the U.N. General Assembly.
Later Tuesday, Obama was to shift his attention to Afghanistan when he meets with that country's leader, Hamid Karzai. It's the first time the two leaders have met in person since Obama announced plans to withdraw more than 30,000 U.S. troops from Afghanistan by the end of next summer.
Obama and Karzai's meeting also comes amid news that Afghanistan's former president was killed in Kabul Tuesday by a suicide bomber. A Karzai spokesman said the Afghan president would cut short his trip to the U.S. after meeting with Obama, and fly back to Kabul.
Obama's withdrawal plan aims to put the Afghans on a path toward taking full control of their own security by the end of 2014.
With U.S. troops expected to stay in Afghanistan well beyond 2014, Obama and Karzai's discussion will focus in part on negotiations over a broad security deal to provide a framework for long-term U.S. military and economic support for Afghanistan. The agreement, now in draft form, would give the U.S. use of Afghan-run or jointly run bases after 2014. U.S. officials stress that the U.S. military presence will be at Afghanistan's invitation.
The two countries appear close to an agreement, but sticking points remain, such as who will control detention of suspected militants and leadership of counterterrorism raids that are unpopular with the Afghans.
The U.S. has said any security agreement would not hold the legally binding force of a treaty, raising some questions over the enforceability of any pact.
Looming over Obama's meetings Tuesday was an approaching clash over Palestinian statehood.
Palestinian leader Mahmoud Abbas said despite being under "tremendous pressure" to drop the effort, he plans to ask the U.N. Security Council to grant Palestinians full membership, a bid certain to be vetoed by the U.S.
U.S. officials are insisting there is still time to avoid a divisive showdown, and have been reaching out to Western allies in hopes of a last-minute compromise.
The Palestinian statehood bid is also a domestic concern for Obama, who faces skepticism from some Jewish voters who believe he's anti-Israel. Congressional lawmakers from both parties are also threatening to cut off $500 million in economic and security assistance to the Palestinians if they move forward with the U.N. bid.
Obama is also using his time in New York to raise money for his re-election bid. The president spoke at one fundraiser Monday night and was to speak at another Tuesday night, both to raise money for his campaign and for the Democratic National Committee.