Several people were injured in the attack
At least 37 people, mostly foreigners, have been killed and 36 injured in an attack on a beach in the Tunisian resort town of Sousse, according to the health ministry.
Officials say one gunman has been shot dead and another is being pursued.
Tunisians, Britons, Germans and Belgians and at least one Irish citizen are among the dead.
In March militants killed 22 people, mainly foreign tourists, in an attack on a museum in the capital Tunis.
Tunisian President Beji Caid Essebsi has gone to Sousse's Sahloul hospital to visit the injured.
Security officials said one attacker, who had posed as a swimmer but was carrying a rifle under a parasol, was shot dead in an exchange of fire with police.
Local media reported that the second attacker had been arrested, but this has not been confirmed. A photo purporting to show the body of the first attacker is circulating on social media.
The shooting in Tunisia comes on the same day as:
One of those killed was an Irish woman, Irish Foreign Minister Charles Flanagan said.
A British man on holiday told the BBC that he heard the attack on a neighbouring hotel.
From his room, he saw a man with a pistol but did not know whether this was an attacker or a member of the security forces.
The Hotel Imperial Marhaba was named as one of the hotels close to the attack.
It is often hard to prove the links between separate cases of violence, even when claims of responsibility are issued by the same group.
Violence is often driven by local grievances, with militant factions switching allegiances as the fortunes of bigger international "franchises" like al-Qaeda and Islamic State rise and fall.
That leads to uncertainty as to whether the bigger group directed, co-ordinated, or inspired a given attack, or simply claimed it after the fact. That is what officials and security analysts will be seeking to understand in the aftermath of this bloody day.
Police were seen detaining this man in the aftermath of the attack
The bodies of the victims were strewn across the beach
Tourists were ordered off the beach into the neighbouring hotels
Briton Glenn Leathley told the BBC his daughter had been at the scene and rang him to say "there's gunfire on the beach".
Another British holidaymaker, Steve Johnson, told the BBC: "We were just laying on the beach as usual and... we heard what we thought at first was fireworks.
"But it was soon pretty obvious... that it was firearms that were being discharged and people screaming and starting to run."
One image circulating on social media appeared to show a man lying face down in the sand with what looks like blood around his head.
The Islamic State militant group had called on its followers to increase attacks during the Islamic fasting month of Ramadan, but no-one has yet said they were behind this attack.
The UK Foreign Office said the British embassy in Tunis was sending a crisis team to the area.
"Any British nationals in these hotels or nearby should remain indoors, and contact their tour operator and the Foreign Office. For security reasons they should not advertise their location on social media or when speaking to journalists," the FCO sais in its updated travel advice.
The Belgian foreign ministry is advising against all travel to Tunisia and the Belgian Jetairfly airline has announced it is cancelling all flights to Tunisia because of the attack.
A spokeswoman for the Thomson and First Choice tour operators said: "We are working closely with our teams in Tunisia and the relevant authorities to determine exactly what has happened and provide assistance to those affected."
Tunisia has seen militant Islamists gain strength since the overthrow of long-serving ruler Zine al-Abidine Ben Ali in a popular uprising in 2011.
Democratic elections after Ben Ali's removal saw the moderate Islamist Ennahda party take power before the secularist Nidaa Tounes government won a parliamentary poll in October.
However, neither party has been able effectively to combat Islamist violence made worse by a raging conflict in neighbouring Libya and by Tunisian fighters returning home after going to join Islamist campaigns in Iraq and Syria.