As Chad celebrated 60 years of independence last summer, President Idriss Déby, a former army general who once routed Libyan leader Moammar Gaddafi’s troops in the Sahara Desert, donned white gloves and full dress uniform to receive the honorary rank of marshal.

Mr. Déby had by then led Chad for nearly three decades, half the country’s existence as an independent nation. After coming to power through a coup, he survived multiple rebellions and emerged as a powerful Western military ally against Islamist extremism, even as his government acquired a reputation for corruption, nepotism and human rights abuses.

Fiercely devoted to the Chadian army, he used the country’s oil wealth to build one of the most accomplished fighting forces in Central Africa. They battled Islamist militants across the Sahel, including the Nigerian terrorist group Boko Haram and al-Qaeda’s regional affiliate, al-Qaeda in the Islamic Maghreb, or AQIM. And when they went on the offensive, political analysts said, it was not unusual for Mr. Déby to visit them on the front lines.

It was there that Mr. Déby was fatally wounded, according to the Chadian military. Gen. Azem Bermandoa, an army spokesman, said in a statement broadcast on state television that Mr. Déby “took his last breath defending the territorial integrity on the battlefield.” He died April 20 at age 68, the day after being announced as the winner of a sixth term in office following a disputed presidential election.

The exact details of Mr. Déby’s death remain murky. His campaign had previously announced that he was traveling to the country’s north to visit Chadian troops fighting the Front for Change and Concord in Chad, a rebel group known by the French acronym FACT. The army statement said the country would be run for the next 18 months by a transitional military council led by Mr. Déby’s son, Gen. Mahamat Kaka.

Mr. Déby was one of Africa’s longest-serving heads of state, a political survivor whose marble-floored palace in N’Djamena, the capital, looked out over one of the world’s least-developed nations, an impoverished, landlocked country of about 16 million people.

“He became a key partner for France and the United States in fighting counterterrorism, but he ruled with an iron fist,” said Judd Devermont, director of the Africa Program at the Center for Strategic and International Studies. “He’s got a track record of being an African strongman who worked hand in glove with the West to address these broader security issues,” while doing little to promote democracy in his country.

When Mr. Déby seized power in December 1990, riding into the capital in a black Mercedes as crowds cheered, he promised his administration would be far different from that of his predecessor, the dictator Hissène Habré, whom he had previously served as army chief of staff.

“The MPS will see to it that Chad becomes a democratic country,” he told a French radio broadcaster, referring to his political party, the Patriotic Salvation Movement. “I’m going to bring changes.”

In a phone interview, French political scientist and Chad expert Marielle Debos said Mr. Déby’s government was repressive but far less ruthless than that of Habré, who was later accused of systematic torture and killing up to 40,000 people. (In 2016, an international tribunal in Senegal found him guilty of human rights abuses and delivered a life sentence.)

Mr. Déby organized the country’s first multiparty elections, Debos said, amid a “wave of freedom and democracy and hope in Francophone Africa.” Trade unions, civil society associations and private radio stations sprang up. Newspaper and radio reporters were occasionally arrested for critical coverage of the regime, but were sent to jail rather than killed. Political opponents were often co-opted, offered jobs in the government.

“He was really a master of the divide and rule strategy,” said Debos, author of “Living by the Gun in Chad.” “The trouble with Chad is it’s really difficult for the civilian opposition to do more than just survive.”

In periods of discontent, the government curtailed Internet service, notably blocking all social media for more than a year after announcing constitutional reforms in 2018 that would enable Mr. Déby to stay in power until 2033. Critics said politically motivated violence persisted as well, noting the 2008 disappearance of opposition leader Ibni Oumar Mahamat Saleh, who was seized from his home in N’Djamena.

In the run-up to the April election, opposition candidate Yaya Dillo — a former rebel leader who once served in Mr. Déby’s government — said his mother, son and three others were killed during a raid on his home by security forces. A government statement said the commando-style operation was an attempt to arrest Dillo, who had allegedly failed to respond to two judicial summons. Several opposition candidates quit the presidential race in protest of the attack.

Mr. Déby maintained the posture of a military strongman while insisting he believed in open elections. His military was supported at times by the French, who headquartered their regional anti-terrorism operation in N’Djamena and dispatched fighter planes to strike a rebel column that was reportedly headed toward the capital in 2019.

The rebel advance that year was one of many attempted revolts faced by Mr. Déby, who survived an attack on the capital in 2006, when several of his uncles and nephews joined a breakaway group of generals, and again in 2008, when insurgents encircled the presidential palace before being pushed back.

Looking back on Chad’s history of postcolonial coups and revolts, he could be coy. “Unfortunately,” he told the New York Times in 2015, “we have known lots of adventures in this country.”

By many accounts, Idriss Déby Itno was born in Fada, then a dusty village in northeastern Chad, in 1952. His father was a herder, and the family was part of the Zaghawa ethnic group, a minority in the country that came to power along with Mr. Déby.

He went to officer training school in N'Djamena before going to France, where he earned a pilot's license in the mid-1970s. Returning to Chad, he joined the rebel army that enabled Habré to seize power in 1982, and became something of a national hero after successfully fighting Libyan forces that had crossed into northern Chad. French newspapers called him the "cowboy of the desert."

Mr. Déby later served as a defense adviser under Habré before fleeing the country in 1989 amid accusations that he was plotting a coup. Traveling to Sudan, he formed his political party, MPS, then obtained weapons from Libya — his former enemy — that helped his soldiers topple Habré's government in just three weeks.

Following a six-year "transition" period, he was elected president in 1996. Beginning in the early 2000s, he faced a humanitarian crisis when several hundred thousand refugees streamed across the border from Sudan's Darfur region in the east. They were later followed by refugees fleeing conflict in the Central African Republic to the south and in Nigeria to the west, where Boko Haram remains a security threat around Lake Chad.

Mr. Déby faced a host of additional challenges, including changing rain patterns and frequent droughts driven by climate change. About two-thirds of Chadians live in severe poverty, according to the United Nations World Food Program.

But development initiatives often took a back seat to the military under Mr. Déby, whose government reaped billions of dollars in oil revenue from a roughly $4 billion pipeline built with funding from the World Bank and a consortium of oil companies led by ExxonMobil. Mr. Déby had agreed to invest most of the revenue in health, education and infrastructure projects, and stunned his World Bank partners in 2000 when he declared that he had used almost $4.5 million of Chad's first oil receipts to buy weapons.

Mr. Déby had several wives, including first lady Hinda Déby Itno and Amani Musa Hilal, the daughter of a key Sudanese militia leader. He had at least 10 children, including his son Brahim, who was killed in Paris in 2007. Complete information on survivors was not immediately available.

In interviews, Mr. Déby dismissed the former military generals and other rebels who repeatedly sought to force him from office, and issued a warning against those who sought to take his place. “Being a rebel is rather simple,” he told the Times in 2006, in the wake of a failed revolt in the capital. “You have men with arms and your objective is clear, to rule a country. But this is a very difficult country to run.”

Read more: