Tunisia's government said on Tuesday that the Tunisian gunman who carried out a deadly attack on a hotel in Sousse last Friday trained in a Libyan militant camp last year.
In the assault carried out on the Imperial Marhaba beach hotel in the popular resort town of Sousse, 38 tourists - most of them Britons - were killed.
The death toll was revised down on Tuesday to 38 people from a previously estimate of 39.
Saif Rezgui - the perpetrator of the beach attack who was killed by police following his rampage - was in Libya at the same time as the two Tunisian gunmen who subsequently stormed the Tunis Bardo museum in March, a spokesman for the Tunisian prime minister said.
Tunisian Prime Minister's Spokesman Dafer Neji told Reuters that "Rezgui had training in Libya at the end of 2014. He was trained during the same time in Libya as the Bardo attackers."
During the Bardo museum assault 21 people were killed. ISIS claimed responsibility for the attack.
Tunisian authorities have arrested three other men accused of helping Rezgi in planning the attack.
The two attacks targeted the Tunisia's vital tourism industry.
Sousse is one of Tunisia's most popular beach resorts, drawing visitors from Europe and neighbouring North African countries.
Tunisia has lost at least $515 million in tourism income following the beach attack.
"The attack had a great impact on the economy, the losses will be large," Tourism Minister Salma Loumi told reporters late on Monday, estimating the damage from the Sousse attack.
The Tunisian government decided to close 80 mosques "out of state control" for inciting violence as part of several immediate measures taken after the armed attack on the beach.
Due to the lack of order in eastern Libya, ISIS was able to expand its influence in the country uncontested on the ground. It has occupied parts of the central city of Sirte where forces from the Tripoli-allied Dawn Alliance’s Misrata-based 166th battalion continue to clash with the militants.
Dozens of militants have passed into Tunisia from Algeria, with ISIS-affiliated militants vowing earlier on social media to carry out more attacks in Tunisia.
More than 3,000 Tunisians have also left the country to fight for ISIS in Syria, Iraq and Libya, and some have threatened to return and carry out attacks in their homeland.