Eight suspects, including a woman, remain in custody on suspicion of being directly linked to Friday’s deadly attack on holidaymakers in the Tunisian resort of Sousse, a minister has said.
Four other people who had been detained have been released, he added.
Thirty-eight tourists were killed when a gunman opened fire on a beach. Islamic State has claimed responsibility for the attack.
Thirty of the victims were British, Foreign Secretary Philip Hammond said.
“We can say with a high degree of confidence that is now the final death toll of British nationals killed in this incident,” Mr Hammond said.
Tunisia’s government fears the attack will destroy its tourism industry, the country’s biggest foreign currency earner.
In March, two gunmen killed 22 people at the famous Bardo museum in Tunisia’s capital, Tunis.
Government minister Kamel Jendoubi said at a media conference that investigations had “allowed us to discover the network behind the operation in Sousse”.
He did not elaborate on the identities of the suspects or their alleged role.
Mr Jendoubi said 10 UK investigators were assisting with the investigation, the AFP news agency reports.
He added that Tunisia has deployed 1,377 armed security agents at hotels and on beaches to guarantee the safety of people, AFP reports.
Tunisian authorities have identified 28-year-old student Seifeddine Rezgui as the gunman who carried out the attack.
The BBC’s Rana Jawad in Tunisia says his former room-mates are among those who have been freed.
Police have released photos of two suspects, Bin Abdallah and Rafkhe Talari – friends of Rezgui whom they are yet to locate.
Officials believe both the Sousse and Bardo museum gunmen were trained in Libya, which has been mostly lawless since Nato-led forces overthrew long-serving ruler Muammar Gaddafi in 2011.
IS has built a significant presence in Libya, Tunisia’s eastern neighbour, and is thought to control the major towns of Derna and Sirte.
Tunisia beach attack: The victims
Foreign Secretary Philip Hammond has announced that all 30 Britons killed in the attack have been identified.
Some survivors have also been speaking out about their ordeal.
Background and analysis
- What we know so far
- Special report on the Tunisia attack
- Profile of gunman Seifeddine Rezgui
- Why was Tunisia targeted?
- How do terrorist attacks affect tourism
- Tributes have been paid to victims in England, Wales, Scotland and Northern Ireland
- What can UK police do?