GILI TRAWANGAN, Indonesia — On the evening the earthquake struck the tiny island of Gili Trawangan, it was easy to panic. The ground swayed and the lights went out. Walls fell over and windows broke. At least one small hotel collapsed.

The government issued a tsunami warning, and thousands of tourists and workers rushed to safety atop the island’s only hill. The warning was canceled soon after but the refugees stayed put through the night, tormented by aftershocks and barely sleeping.

The next day, hundreds of anxious tourists and workers crowded the main beach on Gili Trawangan and waited hours for rescue boats to arrive. Videos of the scene — and foreigners’ complaints of a slow government response — went viral.

“When the earthquake happened, everybody was in a panic,” said Guntur Sakti, a spokesman for Indonesia’s Tourism Ministry. “It was even more chaotic when there were rumors about a tsunami. People wanted to flee. But to expect us to provide boats to evacuate them right at that moment, that was not possible.”