NAIROBI, Kenya — The rebels pulled off a stunning feat. Barely a week after their armed convoy roared across the desert into northern Chad, they kicked off a battle that on Monday claimed the biggest scalp of all: Idriss Déby, Chad’s iron-fisted president of three decades, killed on the battlefield when a shell exploded near his vehicle, according to a senior aide.
On Wednesday, a day after his death was announced, a sense of apprehension and disbelief reverberated through the capital, Ndjamena, where the military formally installed as interim president Mr. Déby’s 37-year-old son, Mahamat Idriss Déby. Rumors of an impending rebel attack on the city coursed through its streets.
But the secret of the rebels’ striking success thus far lay behind them, across Chad’s northern border in Libya, where they have been fighting as soldiers of fortune for years, amassing weapons, money and battlefield experience, according to United Nations investigators, regional experts and Chadian officials. In effect, the rebels used Libya’s chaotic war to prepare for their own campaign in Chad.
Until recently they were employed by Khalifa Hifter, a powerful Libyan commander once championed by President Donald J. Trump. They fought with weapons supplied by the United Arab Emirates, one of Mr. Hifter’s main foreign sponsors.
And they were based last year at a sprawling Libyan military air base alongside mercenaries from the Wagner Group, the Kremlin-backed private company that is considered a spearhead for Russia’s covert efforts to spread its military influence across Africa.
Experts say the unexpected coup by the Chadian rebels offers a stark example of how the decade-old power vacuum in Libya, starting with the ouster of the dictator Col. Muammar el-Qaddafi in 2011, has incubated an array of mercenaries and other armed groups, some of which are now spreading chaos in the region.
“The civil war in Libya has created an environment in which armed groups, not just from Chad but from all over the place, can thrive and find sponsors and allies,” said Nathaniel Powell, a research associate at the Center for War and Diplomacy at Lancaster University in Britain, and the author of “France’s Wars in Chad.”
Uncertainty has seized Chad since the death of Mr. Déby, casting doubt on the stability of a nation viewed by the United States and France as a linchpin of their efforts to counter Islamist militancy spreading across western and central Africa.
In a statement on Wednesday the rebels, who go by the name Front for Change and Concord in Chad (F.A.C.T., by its French acronym), threatened to march on Ndjamena this weekend, following Mr. Déby’s funeral planned for Friday.
Whether the rebels can deliver on that threat is unclear. They suffered heavy losses early this week — Chad’s military claimed to have killed 300 rebels — and foreign military officials are unsure how far the rebel force is from the capital.
Even so, the Chadian military fortified the defenses around the presidential palace on Wednesday, where officials denied persistent rumors that Mr. Déby’s successor, his son Mahamat, had also been killed or injured.
“If he has been shot or dead, that means he’s a good actor, because he is alive and kicking,” said Acheikh Ibn-Oumar, a senior presidential adviser who said he was speaking from inside the palace.
There are still questions about the circumstances of the elder Mr. Déby’s death, and whether he was in fact killed by a rival. But Mr. Ibn-Oumar, echoing statements by military leaders, insisted the president was killed when a rebel shell exploded near his vehicle near Nokou, 170 miles north of Ndjamena.
Mr. Déby was killed on the day he won his sixth election, marred by irregularities. Western countries had largely overlooked his dismal record of corruption and rights abuses because he was a bulwark against the rising tide of Islamist militancy in the Sahel, an arid swath bordering the Sahara that spans six African countries.
France has had a continued military presence in Ndjamena since 1986, and its counterterrorism operation in the Sahel, known as Operation Barkhane, has been headquartered in Chad’s capital since its launch in 2014. France says at least 1,000 of its soldiers are currently based in Chad.
But the rebels looking to overthrow Mr. Déby represented an array of local grievances against the iron-fisted, 31-year rule of an old-fashioned African strongman accused by critics of squandering Chad’s considerable oil revenues, leaving it among the poorest countries on earth.
Since the 1990s an array of rebel groups, many defined by ethnic identity, have sought to overthrow him. Some were based in the Darfur region of western Sudan, where they received funding and weapons from the Sudanese dictator Omar Hassan al-Bashir.
After Mr. al-Bashir and Mr. Deby struck a peace deal in 2010 and agreed to stop backing rebels fighting each other’s governments, the Chadian rebels were forced to leave Sudan. They found a new base, a year later, in Libya.
In the chaos that followed the ouster and death of Col. Qaddafi in 2011, rival Libyan factions hired African mercenaries to fight alongside their own forces. The Chadians, who have a reputation as dogged desert fighters, were in high demand.
Some Chadians even swapped sides, if the price was right.
The F.A.C.T. started out with out with a Libyan faction based in the central city of Misurata, said a United Nations official who has spoken with the group’s leadership, but was not authorized to speak to the media. But by 2019 they had switched their support to a rival faction, led by Mr. Hifter, which had launched a campaign to seize the capital, Tripoli.
The Chadians are by no means the best-known foreign mercenaries in Libya. Far greater attention has been paid to the Russian and Syrian fighters who played a key role in Mr. Hifter’s push for Tripoli.
But the money, weapons and experience gathered by African mercenaries, mostly from Chad and Sudan, is now being put to use in other countries.
A U.N. report published in February noted that F.A.C.T. fighters were based at a major military air base in Al Jufra, in central Libya — an airfield that is also a hub for Russian mercenaries from the Wagner group, which has received cargo flights carrying weapons from the United Arab Emirates, the report notes.
The U.N. also noted that an airplane owned by Erik Prince, the former Blackwater owner who organized an ill-fated $80 million mercenary operation for Mr. Hifter, had been photographed at the Jufra air base.
Following the collapse last year of Mr. Hifter’s assault on Tripoli, the warring factions in Libya signed a cease-fire agreement in October that has mostly held.
As the fighting in Libya ended, the Chadian fighters returned home for the uprising they launched against Mr. Déby on April 11. They may have brought some of the advanced weaponry from Libya with them, said Cameron Hudson, a former State Department official now at the Atlantic Council, a research body in Washington.
He said that the Chadians appeared to be traveling in the same kind of armored vehicles that the Emiratis had donated to Mr. Hifter.
The U.N. official said that, even at the height of the Libyan war, the rebels had always intended to go home to Chad.
“That’s their real interest,” he said. “They talked about gathering as many weapons as they could and going back to Chad.”
Mahamat Adamou contributed reporting from Ndjamena, Chad, and Elian Peltier from London.