A Tunisian court held on Friday its first public hearing in the trial of 26 people in connection with an attack on a beach resort that killed dozens of foreign tourists in 2015.

Six of the defendants are policemen accused of failing to assist a person in danger.

The remainder, all Tunisians, are accused of "terrorism offences, murder and conspiracy against the security of the state", the prosecution said.

In the June 26, 2015 attack Seifeddine Rezgui, a 23-year-old student armed with a Kalashnikov assault rifle and grenades, went on a rampage in the Port el-Kantaoui resort near Sousse, killing 38 holidaymakers, 30 of them British tourists, before being shot dead by police.

He acted alone during the attack but had accomplices who supported him beforehand, authorities said.

It was the second of two deadly attacks on foreigners claimed by the Islamic State in Iraq and the Levant (ISIL) armed group that year, and devastated Tunisia's once-lucrative tourism sector.

OPINION: Tunisia's security-first approach

Security was tight at the Tunis court for the trial opening.

The examining magistrate finished his investigation in July last year, but defence lawyers said they would ask for an immediate adjournment at the opening hearing to give them more time to study the prosecution's case.

Ines Harrath said her client, Achraf Sandi, was charged with "belonging to a terrorist group and using weapons", but was "neither a Salafist nor a terrorist".

She said he had been arrested "because his brother, who is on the run, is accused of involvement in the case".

There has been widespread criticism of the Tunisian police force's response to the killings.

British judge Nicholas Loraine-Smith, who held an inquest into the deaths of the Britons among the holidaymakers, said in February that the police response had been "at best shambolic, at worst cowardly".

"Their response could and should have been more effective," he said.

Andrew Ritchie, a lawyer representing 20 victims' families, read out a January 2015 report by a British diplomat, saying there had been "little in the way of effective security to prevent or respond to an attack" at the beach.