Prime Minister David Cameron said that Friday's attack at a Tunisian hotel demonstrated the "level of evil" Britain is dealing with and drew parallels with previous attacks at magazine offices in Paris and in schools in Pakistan.
Writing in the Telegraph on Sunday, Cameron said "we will not be cowed. To ourshock and grief we must add another word: resolve. Unshakeable resolve."
A gunman disguised as a tourist opened fire at a Tunisian hotel on Friday with a rifle he had hidden in an umbrella, killing 39 people including Britons, Germans and Belgians as they lounged at the beach in an attack claimed by Islamic State.
Cameron said the first priority should be to help the victims of the attack. He said Britain has more than 50 consular staff, police officers and experts from the Red Cross on the ground in Sousse.
His comments come amid media reports that the death toll of British citizens could extend beyond 30 from the current figure of 15.
Cameron said he has been in touch with Tunisian President Beji Caid Essebsi and also thanked Tunisian authorities for their assistance.
On tackling the Islamic State, Cameron wrote that solutions include dealing with the threat at its source in places including Syria, Iraq and Libya.
"That means supporting governments to strengthen weak political institutions and tackle political instability. These ungoverned spaces are the areas in which the terrorist groups thrive," he wrote.
Cameron said confronting the ideology was "perhaps the most important thing."
"To defeat this poisonous ideology, we must be clear about why it is so wrong. We must expose and defeat what it is that persuades young people, from Tunisia to Kuwait, from Belgium to Britain, to join ISIL," Cameron said.
He said that to carry out such an attack in the name of faith and during the holy month of Ramadan was an insult to all Muslims worldwide.
"We must be more intolerant of intolerance – rejecting anyone whose views condone the Islamist extremist narrative."
The attack at the Imperial Marhaba in Sousse, 140 km (90 miles) south of the capital Tunis, was the worst in Tunisia's modern history and the second major massacre this year following the Islamist militant assault on Tunis Bardo museum when gunmen killed 21 foreign visitors.