Mr Cameron went on to say the attack was a "stark reminder" of the continuing terrorist threat and vowed to use Britain's chairmanship of the G8 to ensure that it was right at the top of the international agenda.

"This is a global threat and it will require a global response. It will require a response that is about years, even decades, rather than months," he said.

"It requires a response that is patient and painstaking, that is tough but also intelligent, but above all has an absolutely iron resolve and that is what we will deliver over these coming years.

"What we face is an extremist, Islamist, al Qaeda-linked terrorist group. Just as we had to deal with that in Pakistan and in Afghanistan so the world needs to come together to deal with this threat in north Africa.

"It is linked to al Qaeda, it wants to destroy our way of life, it believes in killing as many people as it can. We need to work with others to defeat the terrorists and to close down the ungoverned spaces where they thrive with all the means that we have."