BREAKING: Tunisia beach killer trained with museum gunmen

The young college student that murdered 38 tourists in a Tunisian seaside resort was in a jihadi training camp in western Libya at the same time as the two attackers who hit the national museum in March, a top security official said Tuesday.

The revelation confirms repeated fears that the strong presence of the Islamic State group in Tunisia's chaotic neighbour is a direct threat to the country.

"It has been confirmed that the attacker trained in Libya with weapons at the same period as the Bardo attackers," said Rafik Chelli, the secretary of state for the Interior Ministry. "He crossed the borders secretly."

Chelli said the 24-year-old Master's student in electrical engineering left his studies at Kairouan University and went to the western Libyan town of Sabratha in January, which is when the two young men that carried out the museum attack were there.

Sabratha, also the site of famed Roman ruins, is known to contain training camps for jihadis.

The March attack on the museum killed 22 people, mostly tourists, and there have been repeated criticisms of the Tunisian government for not doing more to prevent another attack on visiting foreigners.

President Beji Caid Essebsi revealed Tuesday morning that heightened security measures had been scheduled to be put in place just days after the attack in Sousse.

"It is not a perfect system — it is true we were surprised by this affair," he told Europe 1 radio. "They took measures for the month of Ramadan but never did they think the attack would be on the beaches against tourists and the system of protection was set to start July 1."

He added that an investigation was underway into security failures, and there would now be armed tourist police on the beaches and army reservists had been called up.

Essebsi, 88, is a veteran of Tunisia's pre-revolutionary regime and was elected last fall on a platform of restoring security and dignity to the state.

Tunisia's vital tourism sector suffered a staggering blow from the attack.

At least 21 of the victims are British according to the latest figures from British Prime Minister David Cameron, though that number is expected to rise. The rampage continued for around half an hour before the gunman was shot by police.