Updated

Tunisia's president says that a system of heightened security for the fasting month of Ramadan had been set to be in implemented on July 1, before the beach attack that killed 38 tourists.

In an interview with Europe 1 radio on Tuesday, Beji Caid Essebsi said the security plan had been ready, but just not yet in place when a lone gunman attacked a beach resort on Friday.

"It's true, we were surprised by the affair," said Essebsi, who was elected on promises to return security to the country. "The system of protection was set to start on July 1."

Police killed the gunman after his rampage and seven of his suspected accomplices have been arrested.

Essebsi said an inquiry had been opened into any security failures.