The UK faces a "generational struggle" against Islamist-inspired terrorism, David Cameron has warned.
He told MPs the UK needed an "iron resolve" to tackle the threat and put terrorism at the top of the G8's agenda under the UK's presidency.
The prime minister said the threat of terrorism from Afghanistan and Pakistan had reduced, but North Africa was becoming a "magnet for jihadists".
Labour backed Mr Cameron's approach, but said there would be "no quick fix".
Concerns about the growing influence of al-Qaeda in North Africa have been heightened following the deployment of French troops to tackle militant groups linked to the network in Mali and the hostage crisis at an Algerian gas plant, in which at least 48 foreign hostages died after a four-day siege.
Militants behind the attack on the BP gas facility have called on France to end their intervention in Mali.
Mr Cameron told MPs that the "murderous violence" seen in Algeria required a strong security response and the UK would work "right across the region", including in Nigeria, Libya and Mali, to tackle the threat.
'Clash of civilisations'
The UK has already provided logistical support to the French military in Mali, but Mr Cameron insisted there would be "no combat role" for British forces.
He 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.
"We must tackle this poisonous thinking at home and abroad and resist the ideologues' attempt to divide the world into a clash of civilisations."
He said that while the UK had worked hard to reduce the terrorist threat emerging from Afghanistan and Pakistan, al-Qaeda "franchises" had grown in Yemen, Somalia and parts of North Africa.
"In North Africa, as in Somalia, terrorist activity has been fed by hostage ransoms and wider criminality," he said.
"To date, the threat it poses has been to these North African states themselves and, of course, to Western interests in those states.
"But as it escalates it is also becoming a magnet for jihadists from other countries who share this poisonous ideology," he added.
Mr Cameron backed an "intelligent political response" to address underlying political problems in the region.
"Al-Qaeda franchises thrive where there are weak political institutions, political instability and the failure to address long-standing political grievances", he said.
"We must support effective and accountable government, back people in their search for a job and a voice and work with the UN and our international partners to solve long-standing political conflicts and grievances.
"We must frustrate the terrorists with our security. We must beat them militarily. We must address the poisonous narrative they feed on. We must close down the ungoverned space in which they thrive and we must deal with the grievances they use to garner support.
"This is the work that our generation faces and we must demonstrate the same resolve and sense of purpose as previous generations have with the challenges that they faced in this House and in this country."
Labour leader Ed Miliband backed the government's efforts to respond to the growing threat posed by al-Qaeda and other violent extremist groups.
"In particular, the task is to understand the nature of the new threat - more decentralised, more fragmented, taking advantage of the ungoverned spaces and security vacuum in parts of North Africa," he said.
"The work to deal with this threat will be painstaking. Diplomatic and political as much as military. Collaborative and multilateral not unilateral. There is no quick fix."