Security at beach hotels in the Tunisian resort of Sousse was criticised in a report produced for the British Government months before 38 people were killed in a terrorist attack there, an inquest has heard.
The January 2015 "recce" of hotels included the five-star Riu Imperial Marhaba where extremist Seifeddine Rezgui massacred tourists - including 30 Britons and three Irish citizens - the following June.
The inquests into the deaths of the British victims heard the report questioned the security at the beach entrances to some 30 hotels in three neighbouring Mediterranean resorts on the Tunisian coast.
There were just four unarmed security guards on duty protecting the 631 mainly British hotel guests when the bloody attack happened, the hearing at the Royal Courts of Justice in London was also told.
A statement from Mehrez Saadi, the hotel's general manager at the time, also revealed in response to a terror warning in the summer of 2014 the hotel had asked its gardeners to double up as security guards - but only for around a week.
Rezgui killed around 10 of his victims on Sousse's beach and then entered the upmarket hotel from the entrance on the sand.
The resort had previously been targeted by a suicide bomber in October 2013, who killed only himself, the inquest heard.
Andrew Ritchie QC, who represents 20 victims' families, read extracts from the heavily redacted report by a UK embassy official who had been working in Mumbai when the terror attack took place in the Indian city in 2008.
He said: "Given that the attack on the Riadh Palms Hotel in October 2013 was launched from the beach, particular attention was paid to the beach access points.
"It (the report) said 'Despite some good security infrastructure around the hotels and resorts there seems to be little in the way of effective security to prevent or respond to an attack (from the beach)'."
Mr Ritchie told the inquest the government was aware Islamic State-linked extremists had warned the terror group would target tourists in a video posted on YouTube in December 2014.
The inquests have previously heard official guidance for tourists to Tunisia said there was a "high risk of terrorism" at the time of the Sousse attack.
This had not been updated to the highest level of advising against all travel despite a previous terror attack on the Bardo Museum in Tunis in March 2015 that killed 24 people, including 20 tourists.
A counter-terrorism assessment for the FCO days after June's bloodshed in Tunisia also questioned the security at the beach resorts.
The review by the Tunisian Security Assessment Team (TSAT) found "facilities security at the hotels to be generally of a low standard" although "some hotels had better security".
Jane Marriott, a director of the Foreign Office's Middle East North Africa Directorate at the time of the attacks on the Bardo Museum and in Sousse, told the hearing that because, prior to the 2010 revolution, Tunisia had been a dictatorship, there was "little public desire for a more intrusive police presence".
She added: "This made it difficult for the authorities to be proactive with security."
The inquest was shown an extract from minutes of a meeting between UK embassy officials and tour operators in Tunisia shortly after the Bardo attack.
It said: "Following the incident, the knee-jerk reaction was to pull British tourists out of Tunisia.
"Embassy staff here in Tunisia lobbied hard to retain the tourists here in Tunisia but agreed to strengthen the text of the travel advice to reflect the severity of the incident."
Ms Marriott, who was not at the meeting, told the court: "The 'knee-jerk reaction' could be a reference to anybody. I hope not British officials."
Hamish Cowell, the then UK ambassador to Tunisia, took his family to Sousse on holiday less than two months before the attack, the inquest also heard.
Mr Cowell, stayed in a hotel in the Port El Kantaoui area where the attack took place in May 2015, Ms Marriott said, after the attack on the museum in Tunis.