The Libyan civil war (2014–2020), also known as the Second Libyan Civil War, was a multilateral civil war which was fought in Libya among a number of armed groups, but mainly the House of Representatives (HoR) and the Government of National Accord (GNA), for six years from 2014 to 2020.

The General National Congress (GNC), based in western Libya and backed by various militias with some support from Qatar and Turkey, initially accepted the results of the 2014 election, but rejected them after the Supreme Constitutional Court nullified an amendment regarding the roadmap for Libya's transition and HoR elections. The House of Representatives (or Council of Deputies) is in control of eastern and central Libya and has the loyalty of the Libyan National Army (LNA), and has been supported by airstrikes by Egypt and the United Arab Emirates. Due to controversy about constitutional amendments, HoR refused to take office from GNC in Tripoli, which was controlled by armed Islamist groups from Misrata. Instead, HoR established its parliament in Tobruk, which is controlled by General Khalifa Haftar's forces. In December 2015, the Libyan Political Agreement was signed after talks in Skhirat, as the result of protracted negotiations between rival political camps based in Tripoli, Tobruk, and elsewhere which agreed to unite as the internationally recognized Government of National Accord (GNA). On 30 March 2016, Fayez Sarraj, the head of GNA, arrived in Tripoli and began working from there despite opposition from GNC.

In addition to those three factions, there are: the Islamist Shura Council of Benghazi Revolutionaries, led by Ansar al-Sharia, which had the support of the GNC and was defeated in Benghazi in 2017; the Islamic State of Iraq and the Levant's (ISIL's) Libyan provinces; "One is the internationally recognized government based in the eastern city of Tobruk and its military wing, Operation Dignity, led by General Khalifa Haftar. The other is the Tripoli government installed by the Libya Dawn coalition, which combines Islamist militias with armed groups from the city of Misrata. The Islamic State has recently established itself as a third force" the Shura Council of Mujahideen in Derna which expelled ISIL from Derna in July 2015 and was later itself defeated in Derna by the Tobruk government in 2018; as well as other armed groups and militias whose allegiances often change.

In May 2016, GNA and GNC launched a joint offensive to capture areas in and around Sirte from ISIL. This offensive resulted in ISIL losing control of all significant territories previously held in Libya. Later in 2016, forces loyal to Khalifa al-Ghawil attempted a coup d'état against Fayez al-Sarraj and the Presidential Council of GNA.

On 4 April 2019, Khalifa Haftar, the commander of the Libyan National Army, called on his military forces to advance on Tripoli, the capital of the GNA, in the 2019–20 Western Libya campaign This was met with reproach from United Nations Secretary General António Guterres and the United Nations Security Council.

On 23 October 2020, the 5+5 Joint Libyan Military Commission representing the LNA and the GNA reached a "permanent ceasefire agreement in all areas of Libya". The agreement, effective immediately, required that all foreign fighters leave Libya within three months while a joint police force would patrol disputed areas. The first commercial flight between Tripoli and Benghazi took place that same day. On 10 March 2021, an interim unity government was formed, which was slated to remain in place until the next Libyan presidential election scheduled for 24 December that year. However, the election has been delayed several times since, effectively rendering the unity government in power indefinitely, causing tensions which threaten to reignite the war.

Background of discontent with General National Congress At the beginning of 2014, Libya was governed by the General National Congress (GNC), which won the popular vote in 2012 elections. The GNC was made of two major political groups, the National Forces Alliance (NFC) and the Justice and Construction Party (JCP). The two major groups in parliament had failed to reach political compromises on the larger more important issues that the GNC faced.

Division among these parties, the row over the political isolation law, and a continuous unstable security situation greatly impacted the GNC's ability to deliver real progress towards a new constitution for Libya which was a primary task for this governing body.

The GNC also included members associated with conservative Islamist groups as well as revolutionary groups (thuwwar). Some members of the GNC had a conflict of interest due to associations with militias and were accused of channeling government funds towards armed groups and allowing others to conduct assassinations and kidnappings. Parties holding majority of seats and some holding minority of seats began to use boycotts or threats of boycotts which increased division and suppressed relevant debates by removing them from the congressional agenda; voting to declare sharia law and establishing a special committee to "review all existing laws to guarantee they comply with Islamic law"; imposing gender segregation and compulsory hijab at Libyan universities; and refusing to hold new elections when its electoral mandate expired in January 2014 until General Khalifa Haftar launched a large-scale military offensive against the Islamists in May 2014, code-named Operation Dignity (; 'Amaliyat al-Karamah).

Political fragmentation of the GNC The 2012 elections, overseen by the Libyan electoral commission with the support of the UN Special Mission In Libya (UNSMIL) and nongovernmental organizations like the International Foundation for Electoral Systems (IFES), have been considered "fair and free" by most Libyans. However, the elections did not necessarily create a strong government because the Parliament was fragmented due to the lack of organized political parties in Libya post-revolution. The GNC was made up of two major parties, the National Forces Alliance and the Justice and Construction Party, as well as independents in which some were moderates and other conservative Islamists. The GNC became a broad-based congress.

The GNA elected Nouri Abusahmain as president of the GNC in June 2013. He was considered an independent Islamist and a compromise candidate acceptable to liberal members of the congress, as he was elected with 96 out of a total of 184 votes by the GNC.

Libya Revolutionaries Operations Room and kidnapping of Ali Zeidan

The GNC was challenged due to increasing security concerns in Tripoli. The GNC itself was attacked many times by militias and armed protesters who stormed the GNC assembly hall. Following his appointment, Abusahmain was tasked with providing security. He set up the Libya Revolutionaries Operations Room (LROR), which was made up of rebels from Gharyan, and was initially intended to protect and secure Tripoli in August 2013. Its commander was Adel Gharyani. During this time, Abusahmain blocked inquiries into the distribution of state funds and it was alleged that Abusahmain was channeling government funding towards the LROR.

In October, Libyan Prime Minister Ali Zeidan was kidnapped. It is believed to have been carried out by the LROR, although there is evidence to suggest that armed groups such as the Duru3 actually conducted the kidnapping. Following the kidnapping, Abusahmain used his presidency to change the agenda of the GNC in order to prevent them from disestablishing the LROR. At the same time, he cancelled a request to establish a committee to investigate his allocation of 900 million Libyan Dinars (US$720 million) to the LROR and various other armed groups.

The GNC responded by removing Abusahmain as president and dismissing the LROR from its security function. However, the armed group was allowed to continue to operate, and no one was prosecuted for the incident.

Expansion of armed groups during the GNC's term Many Libyans blamed the GNC and the interim government for a continued lack of security in the country. The interim government struggled to control well-armed militias and armed groups that established during the revolution. Libyans in Benghazi especially began to witness assassinations and kidnapping and perceived the GNC to be turning a blind eye to the deteriorating security situation in the east.

But security concerns increased across the country, allowing armed groups to expand in Tripoli and the east. In 2012, the assassination of the US ambassador to Libya by Ansar al-Sharia took place. In October 2013, the kidnapping of Prime Minister Ali Zeidan by the LROR took place. The kidnapping of Egyptian diplomats in January 2014 also by the LROR took place. In March 2014, armed protesters allegedly linked to the LROR stormed the GNC parliament building, shooting and injuring two lawmakers and wounding several others. In April 2014, an anti-terrorist training base called "Camp 27", located between Tripoli and the Tunisian border, was taken over by forces fighting under the control of Abd al-Muhsin Al-Libi, also known as Ibrahim Tantoush, a long-serving Al-Qaeda organizer and former member of the Libyan Islamic Fighting Group. The Islamist forces at Camp 27 have subsequently been described as part of the Libya Shield Force. The Libya Shield Force was already identified by some observers as linked to al-Qaeda as early as 2012.

GNC's political isolation law Although Islamists were outnumbered by Liberals and Centrists in the GNC, in May 2013 they lobbied for a law "banning virtually everyone who had participated in Gaddafi's government from holding public office". While several Islamist political parties and independents supported the law, as they generally had no associations to the Gaddafi regime, the law enjoyed strong public support.

The law particularly impacts elite expatriates and leaders of liberal parties. There existed reservations that such a law would eliminate technocratic expertise needed in Libya at the time.

Armed militiamen stormed government ministries, shut down the GNC itself and demanded the law's passage. This intimidated the GNC into passing the law in which 164 members approved the bill, with only four abstaining and no member opposing it.

Suppression of women's rights GNC opponents argue that it was supporting Islamist actions against women. Sadiq Ghariani, the Grand Mufti of Libya, is perceived to be linked closely to Islamist parties. He has issued fatwas ordering Muslims to obey the GNC, and fatwas ordering Muslims to fight against Haftar's forces

In March 2013, Sadiq Ghariani, issued a fatwa against the UN Report on Violence Against Women and Girls. He condemned the UN report for "advocating immorality and indecency in addition to rebelliousness against religion and clear objections to the laws contained in the Quran and Sunnah". Soon after the Grand Mufti issued a clarification op-ed that there should be no discrimination between men and women yet women have a greater role in the family.

Later in 2013, lawyer Hamida Al-Hadi Al-Asfar, advocate of women's rights, was abducted, tortured and killed. It is alleged she was targeted for criticising the Grand Mufti's declaration. No arrests were made.

In June 2013, two politicians, Ali Tekbali and Fathi Sager, appeared in court for "insulting Islam" for publishing a cartoon promoting women's rights. Two of those charges incurred the death penalty. The case caused widespread concern although they were eventually acquitted in March 2014. After the GNC was forced to accept new elections, Ali Tekbali was elected to the new House of Representatives.