Asked what he would do if one of al-Qaeda's top leaders, or the Taliban leader Mullah Omar, was tracked down to a location in Pakistan or another sovereign territory, he said the US would take unilateral action if required.
He said, "Our job is to secure the United States. We are very respectful of the sovereignty of Pakistan. But we cannot allow someone who is actively planning to kill our people or our allies' people. We can't allow those kind of active plans to come to fruition without us taking some action."
The raid on May 2 in Abbottabad has raised hackles in Islamabad and generated tension between US and Pakistan. Recalling the raid, Obama said "that was as long a 40 minutes as I care to experience during my presidency".
He added that the killing of bin Laden could be a "wake-up call where we start seeing a more effective co-operative relationship" with Pakistan.
On Afghanistan, Obama said that while the conflict could not be solved militarily, raising troop levels had put the Taliban "back on its heels" in a way that could facilitate the brokering of a political reconciliation.
"Ultimately it means talking to the Taliban," he said, adding that the "Taliban would have to cut all ties to al-Qaeda, renounce violence and they would have to respect the Afghan constitution".Obama is due to leave for Europe later today. He will first visit the Irish Republic, then the UK, France, and Poland.