Libya has been mired in chaos since the ouster and killing of Muammar Gaddafi in 2011, with two rival authorities and a multitude of militias still vying for control of the oil-rich country. The capital Tripoli is the seat of an internationally-backed government led by Fayez al-Sarraj, while a parallel administration operates out of the east supported by military strongman Khalifa Haftar.After attackers stormed Libya's foreign ministry on Tuesday, killing at least three people, here is a timeline of the Mediterranean country's descent into turmoil: Gaddafi killed Triggered by uprisings in Tunisia and Egypt, demonstrations erupt in Libya in February 2011. A coalition led by Washington, Paris and London lends its backing to an armed revolt.Gaddafi, who has ruled for 42 years, flees the capital. He is captured and killed on October 20, 2011 during a battle for his hometown Sirte, east of Tripoli.Three days later, the rebel National Transitional Council (NTC) declares Libya's "total liberation".In August 2012, it hands power to a transitional authority, the General National Congress (GNC), elected a month earlier. Embassies targeted US ambassador Chris Stevens and three American staff are killed in a September 11, 2012 attack on their consulate in Libya's second city Benghazi. An Al-Qaeda-linked jihadist group is blamed.A car bomb in April 2013 targets France's embassy in Tripoli, wounding two French guards.Most foreign delegations withdraw from the country. Rival governments Dissident army general Haftar launches an offensive in May 2014 against jihadist groups in Benghazi. He is backed by Egypt and the United Arab Emirates. Several military officers from the east join his self-styled Libyan National Army.As nationalists and Islamists vie for power, legislative elections are held in June and the General National Congress is replaced by a parliament dominated by anti-Islamists.Islamist-led militias contest the results and group under the banner of "Fajr Libya" (Libya Dawn) and storm Tripoli in August, installing their own "national salvation" government and restoring the GNC.The elected house, which has international recognition, takes refuge in the eastern city of Tobruk near the border with Egypt.Thus the country finds itself with two governments and two parliaments.After months of negotiations and under international pressure, lawmakers from the rival parliaments sign a December 2015 accord in Morocco to set up a UN-backed Government of National Accord (GNA).In March 2016, GNA prime minister Sarraj arrives in Tripoli to set up the new government. Haftar's rival administration, however, refuses to recognise its authority. Peace talks, armed groups In July 2017, rival leaders Sarraj and Haftar meet for talks near Paris where they agree to a ceasefire and commit to elections the following year.They meet again in Paris in May 2018, weeks after Islamic State group suicide attackers kill 14 people at Libya's electoral commission, and commit to holding parliamentary and presidential polls in December.In June 2018, a militia attacks two northeastern oil sites under Haftar's control through which oil is exported.After days of fighting, Haftar's forces announce they are back in "full control" and have also seized the city of Derna from radical Islamists.On September 24 the UN's envoy Ghassan Salame stresses that "security cannot remain in the grips of the armed groups but must be in the hands of the state". On November 8 he says the electoral process will begin in spring 2019.An international conference in Palermo later in November lays bare the divisions between key players in the crisis with some delegates refusing to sit side by side.On December 6 the chief of Libya's electoral commission Imed al-Sayeh says a referendum on a new constitution could be held in February 2019 provided security guarantees are met.Attackers storm the foreign ministry in Tripoli on December 25, killing at least three people, including a senior civil servant.* Sign up to News24's top Africa news in your inbox: SUBSCRIBE TO THE HELLO AFRICA NEWSLETTERFOLLOW News24 Africa on Twitter and Facebook.