Tunis: Tunisia’s president has admitted security services were not prepared for last week’s beach massacre.

Friday’s carnage — which saw a gunman kill 38 people, mostly British holidaymakers, at a seaside resort — was the second attack on tourists in Tunisia claimed by Daesh in just three months.

President Beji Qaid Al Sebsi said security had been boosted in other areas for Ramadan, which has seen Islamist violence in previous years, but that authorities had not expected beaches to be a target.

“It is true that we were surprised by this incident. Arrangements were made for the month of Ramadan, but they never thought [measures] had to be taken on the beaches,” Al Sebsi said in an interview with French radio broadcast on Tuesday.

On Friday a Tunisian identified as 23-year-old Saif Rezgui pulled a Kalashnikov assault rifle from inside a beach umbrella and went on a bloody rampage at the five-star Riu Imperial Marhaba hotel in Port El Kantaoui near Sousse, south of the capital Tunis.

Daesh, which controls swathes of Iraq and Syria, swiftly claimed the attack.

“It’s not a perfect system,” Al Sebsi told Europe 1 radio. “If there were failings, disciplinary action will be taken immediately.”

Tunisia vowed new security measures in the wake of the attack and on Wednesday will deploy 1,000 armed officers to reinforce tourism police along its Mediterranean coastline.

There were no signs yet of increased security at the scene of the shooting spree, with no police visible at the hotel or in the surrounding area, an AFP journalist said.

Police and vehicles that had deployed on Monday during a visit by the interior ministers of Britain, France and Germany were gone by Tuesday morning.

Several witnesses to the attack said it lasted more than 30 minutes before the gunman was shot dead, but officials say they were on the scene within minutes.

Thousands of frightened tourists have fled Tunisia since Friday, including at least 4,000 who were flown home to Britain, the country hardest hit.

British Prime Minister David Cameron’s spokeswoman told reporters on Tuesday that 21 Britons have been identified, and another nine British citizens are believed to be among the dead.