On 29 April 1915, Colonel Antonio Miani and force-marching from the Sirtica, was defeated by the Senussi at Gasr Bu Hadi , with 3,000-4,000 casualties. The materiel captured was enormous, calculated at 6.1 million rifle and machine gun rounds, 37 artillery pieces, twenty machine guns, 9,048 rifles, 28,281 artillery shells, and 37 trucks. The Senussi captured more Italian arms than those delivered by the Ottomans and Germans. The Italians soon abandoned Bu Njem and in 1916, a Senussi contingent commanded by Ramadan al-Shtaiwi invaded Tripolitania. The Senussi routed a Bedouin group led by Sayed Safi al-Din at Bani Walid before Sayed Idris recalled the force and accepted the notion of a western limit of Senussi power. Idris established a khatt al-nar  across the Sirtica, to prevent raiding by al-Shtaiwi and his forces, who were armed by the Italians and whose goal was to re-establish themselves inland. In March 1916, Sayed Hilal, a young relative of Sayed Ahmed, presented himself to the Italians at Tobruk, ostensibly seeking food for the starving peoples of the Marmarica. The Italians induced him to convince the Aibadat people to surrender 1,000 rifles in exchange for food and his good offices were used to enter the port of al-Burdi Sulaiman unopposed in May and then Sayed Ahmed's old camp at Masa'ad. His activities disgraced Sayed Idris and negotiations between an Anglo-Italian commission and Idris at al-Zuwaitina broke down. The British launched an offensive and by early 1917, talks resumed at Akrama  and an accord was reached in April. The questions of disarming the populace and of the status of Islamic law were left for the future but the fighting in Cyrenaica came to an end.
Question: Which happened first, the battle at Gasr Bu Hadi, or the Italian abandoment fo Bu Njem?
Answer: Gasr Bu Hadi