Italy had seized military control over Libya from the Ottoman Empire during the Italo-Turkish War in 1912, but the new colony swiftly revolted and transferred large areas of land to Libyan local rule. Conflict between Italy and the Senussis - a Muslim political-religious tariqa based in Libya - erupted into major violence during World War I when the Senussis in Libya collaborated with the Ottomans against Italian troops. The Libyan Senussis also escalated the conflict with attacks on British forces in Egypt. Warfare between the British and the Senussis continued until 1917. In 1917 an exhausted Italy signed the Treaty of Acroma that acknowledged the effective independence of Libya from Italian control. In 1918, Tripolitanian rebels founded the Tripolitanian Republic, though the rest of the country remained under nominal Italian rule. Local agitation against Italy continued, such that by 1920 the Italian government was forced to recognise Senussi leader Sayid Idris as Emir of Cyrenaica and grant him autonomy. In 1922 Tripolitanian leaders offered Idris the position of Emir of Tripolitania. However before Idris was able to accept the position, the new Italian government of Benito Mussolini initiated a campaign of reconquest. From 1923 to 1924, Italian military forces regained all territory north of the Ghadames-Mizda-Beni Ulid region, with four fifths of the estimated population of Tripolitania and Fezzan within the Italian area; and Italian forces had regained the northern lowlands of Cyrenaica in during these two years. However attempts by Italian forces to occupy the forest hills of Jebel Akhtar were met with popular guerrilla resistance. This resistance was led by Senussi sheikh Omar Mukhtar.
Question: Which happened first, Italy giving Libya its independence or foundation of the Tripolitanian Republic?
Answer: Italy giving Libya its independence