Western diplomats sat down for three hours with Libyan commander Khalifa Haftar in his eastern stronghold last month to try to dissuade him from launching an offensive against the internationally recognized government in Tripoli.
They urged him not to plunge the country into a civil war and told him he could become a successful civilian leader if he committed himself to pursuing a political settlement, according to two sources with knowledge of the meeting outside Benghazi.
But Haftar, a military strongman who critics describe as the new Muammar Gaddafi, paid them little heed, said the sources who spoke on condition the ambassadors were not identified. He said he was prepared to negotiate with the prime minister, but if no power-sharing deal was reached, he could invade the capital.
Two weeks later, on April 4, he sent troops from his self-styled Libyan National Army (LNA) streaming towards Tripoli - just at a time when U.N Secretary-General Antonio Guterres was in the city to prepare for a national reconciliation conference this month which Guterres' aides thought Haftar supported.
For world powers including France, Italy and Britain, the general's military campaign, the biggest in Libya since the 2011 uprising that deposed Gaddafi, represented a major setback.
They had tried for years to co-opt Haftar, 75, into a political settlement that would stabilize the major oil and gas producer after almost a decade of conflict that had acted as a breeding ground for Islamist militancy.
Even the United Arab Emirates and Egypt, which have backed Haftar and see him as a bulwark against Islamists in north Africa, appear to have been surprised by his rapid advance. A French diplomatic source said Paris, which has also aided the general, had no prior warning of the offensive.
The diplomats' calls for military restraint in the meeting last month had echoed those from other Western and U.N. envoys who had traveled to Haftar's base outside the city of Benghazi in the preceding weeks, four separate diplomatic sources said.
In a sign of how far the situation in Libya - and Haftar - was beyond their control, U.N. and Western envoys in daily contact with his camp about the conference had no idea he was about to launch the offensive, the four diplomatic sources said.
Some even thought the general was bluffing.
"These are just psycho games," one U.N. official texted Reuters when the first LNA troops were spotted south of Tripoli.
Some diplomats who had met Haftar many times and lobbied their governments to overlook his hardline comments - such as that Libya was not ready for democracy - despaired when it became clear he was committed to taking the city by force.
"I've wasted almost two years on Haftar," said one who met Haftar regularly. "If the national conference doesn't happen, it was for nothing."
EGYPT, UAE, FRANCE
Haftar, for his part, has been consistent in speeches and statements about his commitment to military force in his declared mission to restore order to the north African country and also dropped hints about ultimately ruling the country.
When he first announced his intentions in February 2014 he stood in front of a map of Libya, a somber-looking, gray-haired man wearing an immaculate army uniform, and vowed to stage a coup.
Western countries left Libya after fighting in Tripoli in 2014, closing embassies and ending NATO training programs, before returning in 2016.
Their period of absence opened the door for Arab countries such as Egypt and the UAE, which provided training and military assistance, according to reports from U.N. experts monitoring an arms embargo imposed on Libya in 2011, and diplomats.
Haftar's forces received aircraft as well as military vehicles from the UAE, which had also built up an air base at Al Khadim, allowing the LNA to gain air superiority by 2016, a U.N. report said in June 2017.
But on the ground Haftar was struggling to make progress in his initial campaign launched in May 2014 against Islamist militants in Benghazi, which he dubbed "Operation Dignity". His heavy guns and aircraft flattened residential buildings but could not dislodge the foreign jihadists holed up in booby-trapped houses.
It was at this point that France, which has oil assets in eastern Libya and is politically close to the UAE and Egypt, offered assistance, according to Libyan and French sources.
In late 2015, Paris sent military advisers and special forces familiar in urban warfare who camped out at an air base near Benghazi, the sources said. The French assistance helped turn the tide and allowed him to declare victory in Benghazi in 2017, they added.
Arab countries had recognized Haftar as Libya's official army commander for years but France helped him gain further international legitimacy as his campaign progressed.
In 2017, French President Emmanuel Macron received Haftar and the U.N.-backed Libyan prime minister, Fayez al-Serraj, on the outskirts of Paris to try to persuade them to make a deal, which instantly upgraded the general's diplomatic status.
Macron and Foreign Minister Jean-Yves Le Drian see Haftar, much like Egyptian President Abdel-Fattah al-Sisi, as a buffer against Islamist militants in north Africa, according to French officials.
Le Drian has been to Libya three times in two years and on his last trip, on March 20, he saw Serraj in Tripoli and then traveled east to see Haftar to try to broker a detente.
According to a French diplomatic source, when Haftar asked him why he hadn't come for such a long time, Le Drian responded: "We were waiting for your victories."
He was referring to the general's campaign to take the south of the country earlier this year, the source said.
Following Haftar's Tripoli advance, Egypt's Sisi stressed the need for urgent international action to stop the situation deteriorating, without naming the LNA offensive. The governments of France, Italy, the UAE, Britain and the United States said in a joint statement they were deeply concerned about the fighting.
Le Drian told lawmakers on Tuesday that France feared more serious conflict, adding that Haftar and Serraj needed to agree on a ceasefire before resuming their dialogue.
The UAE mission to the United Nations did not immediately respond to a request for comment on the U.N. reports of military aid to Haftar. Egyptian officials also had no immediate comment on the reports.
RESCUED BY CIA
Haftar was among officers who helped Gaddafi rise to power in 1969 but fell out with him during Libya's war with Chad in the 1980s. Haftar was taken prisoner by the Chadians and had to be rescued by the CIA after having worked from Chad to overthrow Gaddafi.
He lived for around 20 years in the U.S. state of Virginia before returning home in 2011 to join other rebels in the uprising that ousted Gaddafi.
Three years later Haftar made his own move, launching the campaign in Benghazi.
At the time he had gathered only around 200 soldiers and 13 helicopters under his LNA banner, said Jalel Harchaoui, research fellow at the Clingendael Institute international relations think-tank in The Hague.
However Haftar quickly attracted other soldiers such as the Saiqa (Lightning) elite unit as well as tribesmen.
There is no reliable figure for the current size of the LNA, though analysts say it runs into the thousands. The Saiqa alone has 3,500 men and Haftar's sons also have well-equipped units.
Haftar's forces outnumber his opponents scattered in different western cities but he has filled his ranks beyond a core of former Gaddafi soldiers with less trained tribesmen and Salafist fighters and foreign mercenaries, analysts say.
After Benghazi, Haftar gradually took control of the entire east of Libya, before turning his attention to the south.
However this month's Tripoli offensive is the commander's highest-stakes gamble yet.
He has moved much of his forces west, leaving his eastern home base exposed, and making it almost impossible for him to retreat without losing standing among friends and foes alike.
The battle for the capital is still raging, and little is certain. Some pro-Haftar media had predicted victory in 48 hours but the fighting is still mostly outside the city.
Meanwhile, his lightning drive has united opponents in western Libya who had not talked to each other for a long time but have now joined arms.
"Although none of the foreign sponsors behind Haftar is likely pleased with the dramatic deterioration, they have no option but to continue backing him," said Harchaoui. "They have been concentrating most of their bets on one key figure for almost half a decade. This cannot be walked back overnight."