US President Barack Obama has declared that 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 on the horizon," he said at the end of a surprise trip to the country on the anniversary of Osama bin Laden's death.
Shortly after Obama's visit, a series of explosions hit the capital Kabul early on Wednesday, with reports of several people being killed.
"Our goal is to destroy al-Qaeda, and we are on a path to do exactly that," Obama said in his speech on Tuesday, broadcast from the Bagram air base to an American audience halfway around the world.
He spoke after signing an agreement with Afghan President Hamid Karzai, setting post-war promises and expectations.
With two armoured troop carriers as a backdrop, Obama made his remarks amid his endeavour to win re-election as US president and commander-in-chief.
He said that he would keep up the steady withdrawal of troops from Afghanistan and that there was a "clear path to fulfill our mission" after more than a decade of military involvement there.
"My fellow Americans, we have travelled through more than a decade under the dark cloud of war. Yet here, in the pre-dawn darkness of Afghanistan, we can see the light of a new day on the horizon," he said.
"The Iraq War is over. The number of our troops in harm's way has been cut in half, and more will be coming home soon."
Speaking to Al Jazeera's Patty Culhane, Wahid Monawar, former Afghan ambassador to the UN atomic agency, said Obama used "strong words" in his speech.
"The president was really clear. This is a huge day for the Afghan people," Monawar said.
"To reach the agreement, it went through a lot of impediments. There was the issue of the transfer of detainees to Afghan responsibility, the night raids.
"All of that was overcome by the two governments, so I can definitely congratulate the Afghan government for reaching the agreement."
Obama's unannounced visit amid his 2012 re-election campaign appeared aimed at showing US voters he is pursuing a strategy to wind down the war.
He was also seeking to reassure Afghans that Washington was not abandoning them in the face of a continuing Taliban insurgency. Most US and NATO troops are due to leave in 2014.
Earlier in the day, Obama and Karzai signed a strategic partnership accord that charts the future of US-Afghan relations beyond the end of the NATO combat mission in the country in 2014.
The partnership spells out the US relationship with Afghanistan beyond 2014, covering security, economics and governance.
The deal is limited in scope and essentially gives both sides political cover: Afghanistan is guaranteed its sovereignty and promised it will not be abandoned, while the US gets to end its combat mission in the long and unpopular war but keep a foothold in the country.
The deal does not commit the US 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 group is present in neighbouring Pakistan, but has only a nominal presence inside Afghanistan.
Obama's arrival in Afghanistan came a year after American Navy SEALs killed al-Qaeda chief Osama bin Laden in a raid deep inside Pakistan.
The US president, making only his third trip to Afghanistan since taking over as commander-in-chief in 2009, arrived at 17:50 GMT.
Obama's last trip in December 2010 lasted only a few hours when he flew into Bagram air base to meet US troops, but he did not meet Karzai.
Ties between Kabul and Washington have strained since last May amid a series of bloody massacres and incidents by US troops against Afghan civilians as a 130,000-strong US-led NATO force fights a fierce Taliban armed campaign.
The last of the remaining 87,000 American troops in the country are due to pull out by the end of 2014, nearly 13 years after a US-led campaign in late 2001 to topple the Taliban regime accused of harbouring bin Laden.
Senior Obama aides are clearly using the president's decision to launch the high-risk SEAL raid as an implicit comparison to the character of his presumptive Republican rival Mitt Romney.
Obama's campaign last week released a video to mark the anniversary, and suggested bin Laden might be alive today had Romney been in the White House.
US Senator John McCain, who lost to Obama in the 2008 elections, has said the advertisement politicised an issue that should not be fodder for November's presidential campaign.
"Shame on Barack Obama for diminishing the memory of September 11th and the killing of Osama bin Laden by turning it into a cheap political attack ad," he said.
Source: Al Jazeera and agencies