Turkish PM Ahmet Davutoglu has promised to boost security along the country’s border with Syria, after 30 people were killed by a bomb in the town of Suruc.
Investigators think the blast was caused by a female suicide bomber from the Islamic State group.
Correspondents say Turkey is cracking down on the militants, after previously being accused of ignoring them.
But the blast triggered violent protest in Istanbul, with police using water cannon, teargas and rubber bullets.
Friday’s bomb hit a group of youth activists planning to cross into Syria to help rebuild the town of Kobane.
A video shows the group holding a news conference to discuss their plans, when an explosion rips through the young people – mostly of university age – gathered in the grounds of a cultural centre.
They had been chanting slogans and were holding a large banner with the words “We defended it together, we are building it together.”
Kobane is just across the border from Suruc and has been the site of fierce fighting between IS and Kurdish fighters.
It was retaken by the Kurds in January. Suruc houses many refugees who have fled the fighting in Kobane.
Kobane: Inside the town devastated by fight against IS
The attack took place just before noon local time (09:00 GMT). Around a hundred people were injured.
Mr Davutoglu said initial findings suggested it was the work of IS.
“Turkey has taken and will continue to take all necessary measures against Islamic State,” Mr Davutoglu told a news conference in Ankara.
“We are face to face with a terrorism incident. We have the willpower to find and certainly punish those who are responsible.”
“Measures on our border with Syria… will be increased,” he added.
BBC Middle East correspondent Jim Muir says Turkey has been widely accused of turning a blind eye to IS activities, but recently it has been cracking down harder on the militants and this may be one reason for the attack.
The country’s leaders seem likely to toughen their line even further in its wake, he adds.
Protests turn violent
There were large scale demonstrations in cities across the country.
Protests in Istanbul and Ankara turned violent as police clashed with protesters.
A witness told the Reuters news agency that hundreds of protesters in Istanbul chanted slogans accusing Turkish President Recep Tayyip Erdogan of collaboration with IS.
Earlier in the day, the president condemned the attack.
“On behalf of my people, I curse and condemn the perpetrators of this brutality,” he said while visiting Cyprus. “Terror must be condemned no matter where it comes from.”
A spokesman for the White House condemned the attack and expressed “solidarity with the Turkish government and the Turkish people”.