After the United Nations lifted sanctions imposed on Libya in 2003, Libyan leader Muammar Gaddafi set off to improve relations with Europe. He knew that the two most important cards he held were oil money and migration. He knew that France was looking for yet another market for its arms industry and he knew that Italy, being closest geographically to the Libyan shore, was most interested in curbing migration.
In August 2007, France announced arms deals worth $405m with Libya - the first such deal for Tripoli with a Western country since the sanctions had been lifted. The previous month, then French President Nicolas Sarkozy had enjoyed a good deal of PR, helping secure the release of five Bulgarian nurses and a Palestinian held in Libya.
In August 2008, Gaddafi signed a "friendship" agreement with then Italian Prime Minister Silvio Berlusconi in which he agreed to toughen security measures, including joint maritime patrols, to stem the flow of "illegal migrants" to Europe. In return, Italy pledged to pay $5bn to the Gaddafi regime in compensation for the colonial crimes Italy committed during its decades-long rule of Libya.
Gaddafi held up his part of the deal. According to UNHCR figures, the number of migrants crossing the Mediterranean into Europe from Libya dropped from almost 40,000 in 2008 to about 5,000 in 2010.
But with the fall of the Gaddafi regime in 2011, the migration route was reactivated, and in 2016 the number of migrants crossing from Libya to Italy grew to 170,000. At the same time, various extremist groups took advantage of the situation and set up camp in Libya, which the European Union, and especially France (which suffered a number of terrorist attacks in recent years), has perceived as a growing terror threat.
In response, Europe is resorting to its old ways in resolving its issues with Libya – striking a deal with Libyan leadership.
European tug-of-war in Libya
In an attempt to conclude another migration deal with Libya, Italian Prime Minister Paolo Gentiloni invited the leader of the UN-backed National Accord government, Fayez al-Sarraj, to Rome last month. He managed to convince Sarraj to allow the Italian navy to operate inside Libya's territorial waters in order to stem the flow of migrants.
Italy's parliament voted on the move, but Sarraj did not consult others in Libya before accepting Italy's offer, and as a result, he faced widespread criticism back home for allowing what critics deemed "a violation of Libyan sovereignty". Sarraj defended himself by explaining that he did not sign a new deal with Italy and all he agreed was to re-activate parts of the 2008 "friendship" agreement between Gaddafi and Berlusconi, which included joint naval patrols inside Libyan waters.
Joining the wave of criticism was military leader Khalifa Haftar of the self-proclaimed Libyan National Army. After the announcement in Rome, he threatened to bomb Italian ships if they entered Libyan waters.
But just a day before Sarraj's trip to Rome, the two Libyan men met in Paris under the auspices of French President Emmanuel Macron. The reconciliation talks between Sarraj and Haftar - brokered by Macron - resulted in a 10-point statement that expressed commitment on both sides to a ceasefire and the holding of national elections, which angered Italy.
While France and Italy led in unison the 2011 military campaign against Gaddafi, today the two countries are playing a tug-of-war in Libya, which is further destabilising the country. Rome is standing firmly behind Sarraj, hoping he could help with a solution to the migration issue and Paris is backing Haftar, seeing his army as an effective counterterrorism measure.
The permanent resettlement of millions of sub-Saharan migrants in Libya would cause dramatic demographic changes in the country and eventually lead to major social and economic upheaval.
But as the two EU countries are pulling in opposite directions in Libya, reconciliation and a final solution to the current crises will become that much more difficult to achieve.
Back in 2009, when Gaddafi visited Rome to celebrate the ratification of this "friendship" agreement, the refugee policy director at Human Rights Watch, Bill Frelick, said that the agreement looked "less like friendship and more like a dirty deal to enable Italy to dump migrants and asylum seekers on Libya and evade its obligations".
Unfortunately, eight years on, Italy and the rest of the EU intend to dump again an international problem on Libya.
The EU wants to temporarily return migrants to centres and camps in Libya, from where their asylum claims to Europe can be processed. It is no secret that the overwhelming majority of the migrants will not be granted asylum in Europe and hence their temporary housing in Libya will become permanent.
Due to the ongoing violent conflict, Libya is a divided, unstable country with no strong central political authority in place. Some western countries perceive and present the migration crisis as part of this internal conflict and want Libya to take responsibility for thousands of migrants who, after embarking on the dangerous sea crossing, fail to reach or obtain permanent settlement in Europe.
Some have even gone as far as suggesting that Libya - being Africa's third largest country with the highest reserves of natural resources coupled with a very small population (six million) - can permanently accommodate millions of poverty stricken sub-Saharan Africans who want to leave their countries of origin. Hungarian Prime Minister Viktor Orban, said last year that a "giant refugee city" should be built in Libya.
This strategy would practically transform Libya into a buffer zone "protecting" Europe from sub-Saharan migrants. Any such policy, if realised, would jeopardise the future of Libya and would definitely not provide safe and acceptable living conditions to millions of migrants.
The permanent resettlement of millions of sub-Saharan migrants in Libya would cause dramatic demographic changes in the country and eventually lead to major social and economic upheaval. The consequent instability, poverty and violence in Libya would, of course, push desperate people across the Mediterranean again.
So the "solution" to the migration problem that the EU is envisioning is not a solution at all. If it continues to push for it and to have a destabilising effect on Libyan politics, the end result will be much worse than the current situation.
Guma el-Gamaty is a Libyan academic and politician who heads the Taghyeer Party in Libya and a member of the UN-backed Libyan political dialogue process.
The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.