Tunisian security forces “wasted time” before responding to a massacre on a beach resort as 30 British tourists were shot dead, a UK coroner has heard.
In total, 38 people died in the hour-long gun attack near Sousse in June 2015.
But local units deliberately “slowed down” as Islamist gunman Seifeddine Rezgui opened fire, said the counsel to the inquest into the British deaths.
The attack was the deadliest on Britons since the 7 July 2005 London bombings.
The hearing at London’s Royal Courts of Justice – set to last for seven weeks – began with a minute’s silence and the names of all the victims being read out.
From around 11:30 local time, on 26 June 2015, the 38 tourists who visited Tunisia for “relaxation and enjoyment” were “systematically” gunned down, said Samantha Leek, counsel to the inquest.
She said the attack could have been stopped sooner, citing a Tunisian judge’s report into failings by local security units.
Survivors’ story: Alison and Baron
Alison and Baron Caine, who were on the beach when the attack began, told the BBC that they escaped the gunfire and barricaded themselves in their hotel room.
“We started hearing screams, people were running,” Mrs Caine said. “It was like a complete warzone.”
The couple heard a knock on their hotel room door and a man saying he had their key.
“We looked at each other and we just thought this is it, we’re going to die.”
A lone armed guard was on the beach when Rezgui opened fire. The gunman also threw a grenade and left the guard “seemingly unconscious”.
A second armed guard on duty was patrolling the nearby sea in a speedboat. He attempted to shoot Rezgui but could not work his gun.
Nearby security forces “had an ability to put an end to the attack” before the police arrived, Ms Leek said, but they “deliberately and unjustifiably slowed down to delay their arrival at the hotel”.
Meanwhile, witnesses telling of the man with the gun in the speedboat may have led to confusion over how many attackers there were, she added.
Rezgui was shot dead by police about an hour after the attack began.
The court hearing the inquest’s opening day of evidence was filled with relatives and friends of the British dead, who were aged between 19 and 80.
Three people from Ireland, two Germans, one Russian, a Belgian and a Portuguese woman were also killed.
They were all holidaymakers staying in the popular resort of Port El Kantaoui, just north of Sousse.
Three generations of a family – a young man, his uncle and grandfather – were among them.
Families hope for answers
By BBC News correspondent Sarah Campbell
It has been a long wait for survivors and victims’ families as the coroner has collated evidence from Tunisia and elsewhere.
Over the next seven weeks, the circumstances of each individual death will be examined – when, where and how it happened.
But the scope is wider than just the facts, which many of the families are already painfully aware of.
The legal team representing many of the families will be asking whether the victims were made aware of Foreign Office advice that there was a high risk of a terrorist attack in Tunisia, and also questioning the holiday company about security arrangements at the hotel.
Their concern is as much about learning lessons and preventing future deaths as it is about the minute-by-minute accounts of 26 June 2015.
The inquest was shown CCTV footage of Rezgui as he was dropped off in a white van.
Photos of the Imperial Marhaba Hotel, including its beach where the attacks started, were also shown as evidence.
Live TV feeds of the proceedings were also shown in courts in Cardiff and Stirling for survivors and relatives to watch.
Over the next seven weeks, the court will examine whether the UK government and travel firms failed in their responsibility to protect British tourists.
The coroner, Judge Nicholas Loraine-Smith, will look at travel advice issued for Tunisia by the Foreign Office, as well as the security put in place at the hotel by tour operator Thomson.
TUI, the travel company that owns Thomson, is represented at the inquest, as is the government.
The tragedy came shortly after 24 people were killed at a terror attack on the Bardo National Museum in the capital, Tunis, in March 2015.
‘Mastermind’ on the run
The government has applied for some details to be kept private over national security concerns.
The Islamic State militant group said it was behind the attack by the Tunisian student.
The BBC’s Panorama programme this month reported that the suspected “mastermind” behind the shootings is believed to be on the run in Libya.
Chamseddine al-Sandi recruited and directed Rezgui, according to documents obtained by Panorama.
And confessions from suspects arrested by Tunisian police state that al-Sandi ran a militant cell responsible for both shootings – the attacks at Sousse and at the Bardo National Museum.