NAIROBI, Kenya — It was a point of pride for Idriss Déby, the leader of Chad, a vast African country at the crossroads of numerous conflicts, that he was willing to throw himself to the front line of the many battles he fought.
Mr. Déby, a poor herder’s son who rose through the Chadian military to become one of Africa’s most enduring and feared leaders, was killed as he commanded his troops during what the military said was one such battle. His death, at age 68, was announced on Tuesday.
He first distinguished himself more than three decades ago by commanding soldiers to victory against Libyan-backed rebels in the Tibesti Mountains, in the far north of Chad. After seizing power in 1990, he faced down regular uprisings in an impoverished country that often seemed to boil with revolt.
And he embraced elections that he held every five years, always winning — even if those victories were strengthened by his tight grip on Chad’s repressive security forces and its considerable oil revenue.
“He was a hands-on guy,” said J. Peter Pham, a former United States ambassador to Chad, who knew Mr. Déby.
His long rule was also a product of his close ties with France, Chad’s former colonial power, which considered the African autocrat one of its most loyal allies, often turning a blind eye to the suppression of his people.
More recently Mr. Déby endeared himself to the United States after he had taken frontline command of a military force that pursued Boko Haram and its splinter groups, including the Islamic State West Africa Province, which is loosely affiliated with the Islamic State. Mr. Déby called the militants “a horde of crazies and drug addicts.”
Last summer, embracing his image as a warrior king, Mr. Déby took the title of “marshal” in a ceremony in which he wore a dark silk cape and clutched a baton in a scene reminiscent of Mobutu Sese Seko, the kleptocratic former leader of Congo, a country then known as Zaire.
But this week, as Mr. Déby cruised toward a sixth electoral victory that would have made him one of the longest-serving leaders in the world, he went to the front line for the last time.
On April 11, rebels crossed into Chad from Libya — roaring across the desert in a line of vehicles just as Chadians were going to the polls for a presidential election. By last weekend, as fighting intensified, Mr. Déby had flown to northern Chad to command his forces, the army said.
On Tuesday, the army announced that the president had been killed on the battlefield, and that his 37-year-old son, Mahamat, was taking over as the interim head of state. Just a day before, provisional election results showed that Mr. Déby had won almost 80 percent of the vote.
In the capital, Ndjamena, residents scrambled for the safety of their homes, gripped by uncertainty over what might come after the abrupt departure of the man who had led them for three decades.
Mr. Déby was born in 1952, the son of a herder who scraped a living from the harsh deserts of northern Chad. After enrolling in the military, he left in the 1970s for training in France, where he qualified as a pilot, and returned to Chad in 1979 to find the country torn between rival warlords.
Mr. Déby allied with one of them, Hissène Habré, who in 1982 became president and appointed him as his army chief.
Eight years later, Mr. Déby turned his guns against President Habré, whose rule had been characterized by widespread rights abuses, and seized power for himself.
Even then, Mr. Déby faced other rebellions that were stoked by disputes over the exploitation of oil, or rival regional factions. Fighting raged in Ndjamena following an attempted coup in 2006.
Mr. Déby had testy relations with his neighbor, President Omar Hassan al-Bashir of Sudan — another wily autocrat whom Mr. Déby accused of having fomented unrest inside Chad. Mr. Deby allowed journalists and aid workers to pass through Chad into the Sudanese region of Darfur, where they documented abuses that later led the International Criminal Court to indict Mr. Bashir for war crimes including genocide.
Mr. Déby’s rule might have been one of prosperity for Chadians. The country’s vast deserts cover untapped reserves of uranium, as well as oil that is currently pumped at a rate of 130,000 barrels a day, generating much of Chad’s revenue.
But under Mr. Déby, Chad frequently featured prominently in lists of the world’s poorest and most corrupt countries. The adult literacy rate is 31.8 percent; life expectancy is 54 years; and critics accused Mr. Déby of squandering the oil wealth by pouring it into the military, which he has used to repress his critics.
In 2017 the U.S. Justice Department accused Mr. Déby of having accepted a $2 million bribe from a Chinese company in exchange for oil rights in Chad.
Still, such failings were largely overlooked by Western countries that embraced Mr. Déby as an indispensable ally in a dangerous part of the world. Mr. Déby supported a French military operation against Islamist militants in neighboring Mali in 2013, and a year later he helped to end violent turmoil in the Central African Republic.
His army is one of the best trained and equipped in the semi-arid belt of Africa known as the Sahel, and it has played host to military exercises conducted by the United States.
In an email, Col. Christopher Karns, a spokesman for the Pentagon’s Africa Command, said Chad was a major partner in an effort involving several countries in the Lake Chad basin to fight Boko Haram.
France, for its part, did its utmost to protect Mr. Déby himself, deploying troops to Chad in 2008 and 2019 to defeat rebels who tried to unseat him.
After three decades in power, Mr. Déby was aiming for a fourth. In 2018, Chad’s parliament revised the Constitution to allow him to stay in office until 2033. Analysts say his sudden death will likely throw Chad’s politics into disarray.
Some were skeptical that his son Mahamat could hold on for long in the face of challenges from rivals in the security establishment or disaffected members of his own Zaghawa ethnic group, where some had bristled at the rise of Mr. Déby’s family.
“The prospects of more splits within the military is significant,” said Judd Devermont, director of the Africa program at the Center for Strategic and International Studies in Washington. Others speculated that France would struggle to find a new partner in a country that French leaders long considered their African backyard.
“The French have been so associated with Déby — not just propping him up but also eliminating his enemies on his behalf — that they will have a hard time establishing any credibility with a successor regime that doesn’t have the last name Déby and isn’t a Zaghawa,” said Cameron Hudson, an Africa expert at the Atlantic Council.
Eric Schmitt contributed reporting from Washington.