By the time Chad’s electoral commission had declared President Idriss Déby Itno the winner of his sixth term, the former general was already dead or dying from wounds sustained hundreds of miles away at the front line of a firefight with a rebel convoy sweeping south from Libya.

The death of the strongman of N’Djamena — a rare modern case of a head of state dying in battle — blows a hole in the French-led fight against jihadism, removes the west’s greatest African ally in the war on extremism and strands Chadians in the middle of an internal power struggle.

After three decades of his brutal and kleptocratic rule, “the sudden death of President Idriss Déby has left Chad in a state of political, security and social uncertainty”, said Kelma Manatouma, a Chadian researcher at Paris-Nanterre university.

Chad is not only the most important regional army fighting alongside France’s 5,000-troop Operation Barkhane in the Sahel but is the main player in the decade-long fight against jihadis Boko Haram, picking up the slack for Nigeria’s under-equipped army.

“In his absence, if there is not a smooth transition or if this rebellion gets serious and Chad is distracted and taken out of the equation, the security implications for Sahel and even for Nigeria are relatively dire,” said J Peter Pham, who served as Sahel envoy for the Trump administration.

The circumstances of Déby’s death remain murky. With his 37-year-old son now interim leader, some observers have speculated that the mounting resentment within the army and his ruling clan had finally come to a head.

But it was not surprising that on the day election results were announced Déby had travelled hundreds of kilometres to the front line of the battle with Libya-based rebels from the Front for Change and Concord in Chad (FACT), said Cameron Hudson, an expert at the Atlantic Council, even if it was “crazy”.

“This is entirely in keeping with his MO and his persona. He [was] a battlefield commander, that’s where he [was] most comfortable,” said Hudson, a former US government official on Africa. “Previous coup attempts he has gone to the front lines and personally directed assaults and campaigns. He [was] a military tactician through and through and that was a reason Paris and Washington liked him so much.”

General Stephen Townsend, the top US commander for Africa, told Congress that Chadian troops with French support had confronted a rebel column hundreds of vehicles long that appeared to be withdrawing when Déby was apparently struck. Many of the rebels are former Chadian officers.

This was just the latest French intervention on behalf of Déby, who has faced a series of uprisings since seizing power in 1990. Two years ago, Paris sent fighter jets to strike another rebel convoy heading for N’Djamena; in 2008, French soldiers helped beat back another insurrection.

Déby’s hands-on approach against jihadis and his highly capable army encouraged France and the US to turn a blind eye to the repression and rampant corruption that left the oil-rich country among the poorest in the world.

“Whatever else one may think of Déby and how he governed Chad . . . over the course of 30 years he has made himself the centre of a web of political and security links that run across that whole region,” said Pham. “He intentionally made himself useful if not indispensable.”

President Emmanuel Macron, who will attend Déby’s state funeral, called him “a courageous friend” of France, as the Chadian army dissolved parliament and instituted an 18-month transitional military government. France’s foreign minister defended the unconstitutional takeover in the name of “stability” despite an outcry from Chad’s opposition and a general who said he spoke for many soldiers.

The ex-colonial power had “miscalculated” by depending so much on Déby, said a European diplomat in the region. “Chad, and his military and security apparatus at large, was always considered to be the backbone of [France’s military alliance in the Sahel] and this backbone is now in danger,” the person said.

While General Mahamat Idriss Déby, the head of the elite presidential guard, known as “Kaka”, had been groomed to replace his father, “no one in the Chadian regime, whether son or nephew, can lead the country as Déby used to”, said a French diplomat with close knowledge of France’s Africa policy.

The Chadian rebels’ indirect ties to the rogue Libyan general Khalifa Haftar, who failed to overthrow the former government in Tripoli and is believed to have used FACT to secure an air base, complicates matters further.

Haftar has received backing from Paris but also from the United Arab Emirates and Russia, France’s main rival for influence in the neighbouring Central African Republic.

Russia’s indirect support for these rebels hints at a potential proxy war, said Jérôme Tubiana, a researcher focused on Chad. “France is losing the Central African Republic, and now Russia is maybe pushing also against French interests in Chad.”

At the very least “the incursion into Chad shows the potential for blowback due to the practice of the Libyan parties of recruiting foreign mercenaries as fighters,” said Wolfram Lacher, senior associate at the German Institute for International and Security Affairs.

A French diplomat who knew Déby expressed a romantic view of the late president common in Paris, calling him a “warrior” who “wanted to die in battle rather than in a hospital bed”.

“He died as he lived,” the person said. “He was ruthless, cynical, he could have done much better with the oil. But he was in his specific way honest. He didn’t pretend to be what he wasn’t.”

Ayisha Osori, head of the Open Society Initiative for West Africa, said the Parisian view betrayed a casual indifference to the fate of ordinary Chadians.

“It just seems fundamentally unfair that the whole world’s view of Déby is ‘oh, we’ve lost the great soldier’,” she said. “And now we have to do everything to make sure Chad is secure. But we don’t really mean Chad, we just mean the borders around Chad — the border that leads to Mali, to Nigeria, to Sudan, to Central African Republic.

“It is not about the people of Chad and what’s good for them.”

Additional reporting by Heba Saleh in Cairo and Katrina Manson in Washington