"So what we're looking for is a comprehensive strategy. And there's got to be an exit strategy," Obama said.
"But we can't lose sight of what our central mission is," he said.
"These folks can project violence against US citizens, and that's something we can't tolerate"
Saying that the mission was the same as when the US went into Afghanistan after the September 11, 2001 attacks on the US, he said: "These folks can project violence against US citizens, and that's something we can't tolerate."
Obama's comments come as his administration prepares to roll out its new strategy for Afghanistan amid rising violence blamed on the Taliban movement that the US ousted.
The US president said last month's decision to send 17,000 more US troops to Afghanistan was the most difficult he has had to make since taking office in January.
"You know I think it is the right thing to do. But it's a weighty decision because we actually had to make the decision prior to the completion of [the] strategic review that we were conducting," he said.
Dispute over raid
Obama saying that an "exit strategy" was needed comes as the Afghan government said on Sunday that it was deeply concerned about a US military operation which killed five Afghans that police say were civilians, but US forces said were fighters.
The US military said it killed five fighters and detained four others with the help of Afghan troops in the northern province of Kunduz.
The Afghan interior ministry "expressed its deep concern regarding the incident" in which it said "five of our citizens were killed ... in the house of the district mayor".
The ministry said it would send a high profile delegation to Kunduz to investigate the incident.
Colonel Abdulrahman Aqtash, the head of security operations for Kunduz province, also said the dead were civilians working for the district mayor; two were his guards and three were his servants.
But the US military said it was acting on hard intelligence information about the presence of fighters in the area.
"We had multiple sources of intelligence telling us the targeted individual was there," said Colonel Greg Julian, a spokesman for US forces, adding "when we have the level of detail that we have in terms of intelligence we are very certain that we have the right target".
Julian, who said there would be an investigation, said the individuals were given the chance by US troops to exit their compound peacefully, but "they came out fighting and they died fighting... It's very difficult to classify them as civilians under those conditions."
US forces also said the operation was "in co-ordination with local Afghan police" but a senior police official in Emamsaheb district, where the operation took place, told the Reuters news agency that local police were neither involved nor aware of the operation.
More than 2,100 civilians were killed in Afghanistan last year, a 40 per cent increase from 2007, the United Nations says, adding that about a quarter of those were killed by international forces.