AIR FORCE ONE: US President Barack Obama is greeted by Lieutenant General Curtis "Mike" Scaparrotti (left) and US Ambassador to Afghanistan Ryan Crocker (second left) as he steps off Air Force One at Bagram Air Field in Afghanistan.

On a swift, secretive trip to the war zone, President Barack Obama declared today (NZ time) that after years of sacrifice the US combat role in Afghanistan is winding down just as it has already ended in Iraq.

"We can see the light of a new day," he said on the anniversary of Osama bin Laden's death and in the midst of his own re-election campaign.

"Our goal is to destroy al Qaeda, and we are on a path to do exactly that," Obama said in an unusual speech to America broadcast from Bagram Air Field half a world away.

He spoke after signing an agreement with Afghan President Hamid Karzai to cover the decade after the planned final withdrawal of US combat troops in 2014. Obama said American forces will be involved in counter-terrorism and training of the Afghan military, "but we will not build permanent bases in this country, nor will we be patrolling its cities and mountains."

The president landed in Bagram in darkness, and his helicopter roared to Kabul for the meeting with Karzai, under close guard with only the outlines of the nearby mountains visible. Later, back at the base, he was surrounded by US troops, shaking every hand. He ended his lightning visit with the speech delivered straight to the television camera — and the voters he was trying to reach back home.

Two armoured troop carriers served as a backdrop, rather than the customary Oval Office tableau.

His Republican re-election foe, Mitt Romney, was in New York, where the destruction of the Twin Towers on September 11, 2001, set in motion the decisions that led to the wars in both Iraq and Afghanistan.

Romney accused Obama of politicising the fleeting national unity that came with the death of bin Laden, the 9/11 terror mastermind.

At the air base, Obama said, "This time of war began in Afghanistan, and this is where it will end. ... With faith in each other, and our eyes fixed on the future, let us finish the work at hand and forge a just and lasting peace."

Earlier, he delivered a similarly upbeat message to the troops. Noting their sacrifice, he said, "There's a light on the horizon."

It was Obama's fourth trip to Afghanistan, his third as commander in chief. He was less than seven hours on the ground in all. He also visited troops at a hospital at the Bagram base, awarding 10 Purple Hearts.

According to the Pentagon, more than 1800 American troops have been killed across more than a decade of war in Afghanistan.

Some 88,000 remain stationed there.

The wars here and in Iraq combined have cost almost $1.3 trillion (NZ$1.59t). And recent polls show that up to 60 per cent of Americans oppose the continued US presence in Afghanistan.

In his speech to the nation, Obama said, "I recognise many Americans are tired of war."

He said that last year, "we removed 10,000 US troops from Afghanistan. Another 23,000 will leave by the end of the summer. After that, reductions will continue at a steady pace, with more of our troops coming home. And as our coalition agreed, by the end of 2014 the Afghans will be fully responsible for the security of their country."

Without mentioning the political campaign back home, Obama claimed that on his watch the fortunes of the terrorists have suffered mightily.

Over the past three years "the tide has turned. We broke the Taliban's momentum. We've built strong Afghan security forces. We devastated al Qaeda's leadership, taking out over 20 of their top 30 leaders," he said.

"And one year ago, from a base here in Afghanistan, our troops launched the operation that killed Osama bin laden."

In a reference to the destruction of New York's World Trade Center on September 11, 2001, he added, "As we emerge from a decade of conflict abroad and economic crisis at home, it is time to renew America ... a united America of grit and resilience, where sunlight glistens off soaring new towers in downtown Manhattan, and we build our future as one people, as one nation."

He spoke for less than 15 minutes, beginning at 4am in Afghanistan, 7.30pm on the East Coast of the United States and 11.30am today (NZ time). Minutes later, Air Force One was on its way back to Washington.

Obama flew to the site of America's longest war not only as commander in chief but also as an incumbent president in the early stages of a tough re-election campaign. Nor were the two roles completely distinct.

His presence was a reminder that since taking office in 2009, Obama has ended the war in Iraq and moved to create an orderly end for the US combat role in Afghanistan.

In the political realm, he and Vice President Joe Biden have marked the one-year anniversary of bin Laden's death by questioning whether Republican challenge Romney would have ordered the daring raid that penetrated the terrorist leader's Pakistan hide-out. Republicans are accusing the president of trying for political gain from the event, and Romney is insisting that he would indeed have ordered US forces into action.

The deal signed with Karzai does not commit the United States to any specific troop presence or spending. But it does allow the US to potentially keep troops in Afghanistan after the war ends for two specific purposes: continued training of Afghan forces and targeted operations against al Qaeda. The terror group is present in neighbouring Pakistan but has only a nominal presence inside Afghanistan.

Obama said the agreement was meant in part to pay tribute to the US troops who have died in Afghanistan since the war began. He also underlined his message to Afghans.

"With this agreement I am confident that the Afghan people will understand that the United States will stand by them," he said.

Karzai said his countrymen "will never forget" the help of US forces over the past decade. He said the partnership agreement shows the United States and Afghanistan will continue to fight terrorism together. The United States promises to seek money from Congress every year to support Afghanistan.

To the troops, he readily conceded continued hardship.

"I know the battle's not yet over," he said. "Some of your buddies are going to get injured. And some of your buddies may get killed. And there's going to be heartbreak and pain and difficulty ahead." He added that his administration is committed to ensuring that once the war is over, veterans will be given their due.

Officials have previously said as many as 20,000 US troops may remain after the combat mission ends, but that still must still be negotiated.

The president's address was coming exactly one year after special forces, on his order, began the raid that led to the killing of bin Laden in Pakistan.

Since then, ties between the United States and Afghanistan have been tested anew by the burning of Muslim holy books at a US base and the massacre of 17 civilians, including children, allegedly by an American soldier.

Obama had gone twice before to Afghanistan as president, most recently in December 2010, and once to Iraq in 2009. All such trips, no matter how carefully planned, carry the weight and the risks of considerable security challenges. Just last month, the Taliban began near-simultaneous assaults on embassies, government buildings and Nato bases in Kabul.

Besides the US troops in Afghanistan, there are 40,000 in coalition forces from other nations.