With billions of dollars in oil revenues since the early 2000s, military spending at least double that of most African countries, and 40 years of tough civil wars, most of which Mr. Déby has personally taken part in, he has built himself a formidable fighting machine whose movements and actions he coordinates personally, say those who know him.

Without Mr. Déby and his battle-hardened soldiers, analysts and diplomats say, there would be nobody on the ramparts in this vulnerable part of Africa. “The Chadians are essential. They are the most capable military in the region, by a long shot,” said a veteran diplomat who spent years here. “They are pretty much incomparable.”

Now, with Boko Haram on the ropes, temporarily at least, and in no small part thanks to his men, Mr. Déby might seem positioned for a triumphalist victory lap. But those who know him well say this is not how he operates.

“Déby does things coldly. He doesn’t do things out of sentiment. That’s his strength,” said Saleh Makki, a veteran opposition member of Parliament who spent 147 days in Mr. Déby’s jails in 2013 after being accused — falsely, he said — of fomenting a coup plot.

Indeed, the army’s relative strength is itself a function of Mr. Déby’s calculated insecurity. Rebels have made it to the capital twice in the past 10 years, burning ministry buildings, shooting and looting in the streets. The last time, in 2008, Mr. Déby found himself holding out nearly alone in the palace, refusing to evacuate. He took power by force himself at the head of a rebel movement in 1990 and has not budged since.