US President Barack Obama has vowed the United States and its partners would get "the job done" in Afghanistan, on a surprise visit to the country.
After an overnight flight from Washington, the president landed in Afghanistan on Sunday for a stay of just a few hours, all in darkness.
On his first visit to US troops in the country since he became President, Obama thanked the Afghan people and US troops for their sacrifices in the war.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
To cheers from soldiers gathered for his surprise visit to the Bagram air base, Obama told them the American people were proud of them for their courage in the eight-year war.
"We know there are going to be difficult days ahead. We face a determined enemy. But we know that the United States of America does not quit when it starts on something," Obama said.
He added that the United States intended to build "a lasting partnership" with Afghanistan.
Meeting with President Karzai
And he warned that al-Qaeda remained a threat not just to people in Afghanistan and the United States but also to "people around the world".
Earlier, he flew by helicopter from Bagram to the capital, where he met Afghan President Hamid Karzai and his cabinet at the presidential palace.
It was Obama's second stop in a war zone as commander-in-chief, coming about a year after a similarly secretive trip to Iraq.
Karzai was notified about Obama's visit just an hour before he arrived, the White House said.
This trip, its secrecy forced by security concerns, was an extraordinary capstone to a momentous week in Obama's presidency.
He achieved the most ambitious domestic policy initiative in decades with a historic health care overhaul and scored his first major foreign policy achievement with a significant new arms control treaty with Russia.
Troop levels boosted
In December, Obama ordered 30,000 additional forces - for a full force of roughly 100,000 - into the fight against an entrenched Taliban insurgency that seeks to retake the control of Afghanistan that the militant group lost when the US invaded in 2001.
The trip came just two days after a threatening audio message from al-Qaeda leader Osama bin Laden, believed to be hiding along the ungoverned border between Afghanistan and Pakistan.
Obama had gone on Friday afternoon to the presidential retreat at Camp David in Maryland, from which unnoticed departures are easier because of its secluded mountain location.
The small contingent of White House aides and media on the trip were sworn to secrecy, and the White House allowed details of Obama's activities on the ground to be reported only after they were under way.
It was Obama's second visit to Afghanistan; the first was in 2008 when, as a presidential candidate and US senator, he joined a congressional delegation.
Besides talks with Afghan leaders, Obama met General Stanley McChrystal, the top US military commander, and the US ambassador to Afghanistan, Karl Eikenberry.
Afghan war 'unpopular' in US
At least 945 members of the US military have died in Afghanistan, Pakistan and Uzbekistan as a result of the US invasion of Afghanistan in late 2001.
The war is unpopular with a majority of Americans, especially progressives in the base of Obama's Democratic Party.
This was reflected in Obama's new Afghanistan strategy. He combined the large build-up with a call to start bringing troops home in July 2011.
Lately, Obama's approval ratings on his handling of Afghanistan have ticked up, to 57 per cent in a March AP-GfK poll, from 49 per cent in January.
But the challenge ahead is daunting: justify his escalation with clear progress against the Taliban, and in building up and training Afghan army and police forces so they can begin taking over security responsibilities.
Obama's talks with Karzai come as Washington's relationship with the Afghan leader has soured - particularly since last year's flawed presidential elections, concerns about corruption and ineffectiveness in Karzai's central government have mounted.

