KABUL - On the first anniversary of al-Qaida chief Osama bin Laden's death, US President Barack Obama on Wednesday warned US troops of further hardship ahead in Afghanistan but told them "there is a light on the horizon" after more than a decade of war.

Obama made a speedy, unannounced trip to Afghanistan to sign a strategic pact with Kabul and send a dual election-year message that the United States is winding down the Afghan war but not abandoning the country.

Shortly after he arrived, Obama and Afghan President Hamid Karzai sealed the strategic partnership pact, which sets out a long-term US role in Afghanistan, including aid and advisers.

The deal may provide Afghans with reassurances that they will not be abandoned when most NATO combat troops leave in 2014.

But Obama warned US troops of further hardship ahead in Afghanistan. "The battle is not over yet," he told troops at Bagram airbase outside of Kabul, where only months ago thousands of Afghans rioted after US troops accidentally burned copies of the Koran, the Muslim holy book.

The incident plunged relations to their lowest point in years.

Obama made a point of mentioning bin Laden's death in his remarks.

"Not only were we able to drive al-Qaida out of Afghanistan, but slowly and systematically we have been able to decimate the ranks of al Qaeda, and a year ago we were able to finally to bring Osama bin Laden to justice," he said to cheers.

Obama met Karzai at his walled garden palace in Kabul, where they signed the Strategic Partnership Agreement (SPA).

"The wages of war have been great for both our nations," Obama told Karzai.

"By signing this document, we close the last 10 years and open a new season of equal relations," Karzai said in a statement after the meeting.

To American voters in an election year, Obama sought to signal that the US combat role in Afghanistan is drawing to a close, and to remind them of the May 2011 special forces raid in Pakistan that killed bin Laden.

Within Afghanistan, the palace signing ceremony may be aimed at sending a message to the Taliban and other groups that they cannot wait out 130,000 foreign troops and retake power.

It could help push the insurgency's leaders to re-enter reconciliation talks with both the US and Afghan governments.

Please LIKE our Facebook page - it makes us stronger