The Prime Minister told MPs three Britons are known to have been killed, with another three believed to be dead, following the attack on a gas plant.
A seventh hostage, a Colombian national resident in the UK, is also thought to have been killed.
Mr Cameron said it was the UK's top priority to repatriate their bodies, but warned that process could be delayed by forensic and police work.
He also pledged British support to help dismantle the network responsible for their deaths. In words that appeared to echo Tony Blair's response to the September 11 attacks, he also warned the UK faced a wider threat.
He said overcoming the threat posed by al Qaeda and its franchises in North Africa was the challenge of this generation.
His strong words may win him some support. After days in which the hostage situation dominated the headlines, a new opinion poll showed Labour losing a significant part of a substantial lead over the Tories.
Labour's eight-point lead was cut to just five percentage points in an ICM poll of more than 1000 adults carried out between January 18 and January 20.
Mr Cameron said: "Together with our partners in the region, we are in the midst of a generational struggle against an ideology which is an extreme distortion of the Islamic faith, and which holds that mass murder and terror are not only acceptable but necessary."
To fight the threat, he said, "we must demonstrate the same resolve and sense of purpose previous generations had with the challenges that they faced".
He refused to rule out the possibility of using troops, but aides insisted he was not necessarily talking about that.
They said he was advocating tactics such as solving political and economic problems in the region and increasing security and intelligence co-operation.
The Prime Minister pledged to put fighting extremism in the region at the top of the agenda of the upcoming G8 meeting the UK is hosting.
He committed UK intelligence and counter-terrorism assets to working with other countries to find and dismantle the network responsible for the killings.
It is understood he has had discussions with US President Barack Obama and French President Francois Hollande on this.
The Prime Minister also pledged the UK would step up its actions across the entire region, including in Mali, to "prevent a new terrorist haven developing on Europe's doorstep".
The UK National Security Council (NSC) is expected to discuss the ongoing French operation in Mali today, including the help offered by the UK.
The UK also agreed to take part in an EU mission to help train West African troops to take over from the French forces currently fighting in Mali.
Downing Street said less than 20 personnel could be involved, although it added that no decision had been taken. Aides to the Prime Minister also made clear there would be no extra money to fight the extremists.
Mr Cameron was at pains to say the fight would not be won by a military response alone. He said the UK would support countries to build effective and accountable and strong governments, saying he would "back people in their search for a job and a voice".
But his overall message was that patience was needed and that overcoming terrorism could take a long time.
He was forced to reject claims from Labour MPs that he was advocating a "crusading zeal" – a charge also levelled against Mr Blair in the run up to the Iraq war.