Libya was under Italian control from 1911 to 1943. The British had no presence as a colonial power during that time.
Rifles would not be packed loose in a box. They would be firmly packed with some filling between them to stop movement and possible damage.
The British soldiers would have closed the gates prior to the arrival of the Arab horsemen.