DAKAR, Senegal — One president is 82. The other is 78.

They’ve both held power for a decade, the maximum their constitutions allow. But they’re still running this month for fiercely contested third terms.

Alpha Condé, the leader of Guinea, and Alassane Ouattara, the head of Ivory Coast, are vying to extend their tenures on Oct. 18 and 31, respectively, setting off pre-election protests that have left dozens dead across their countries.

The tension is soaring at a fragile moment for West Africa.

A coup d’etat in neighboring Mali brought Ibrahim Boubacar Keïta’s second term to a dramatic end in August, raising concerns about a power vacuum as the nation struggles to fend off fighters linked to al-Qaeda and the Islamic State.

Guinea and Ivory Coast also are vulnerable to attacks, analysts say.

Fellow heads of state in West Africa have urged Condé and Ouattara to reconsider, warning that regional stability is at stake.

“We need to adhere to the constitutional provisions of our countries, particularly on term limits,” Nigerian President Muhammadu Buhari told his counterparts at a meeting last month. “This is one area that generates crisis and political tension in our subregion.”

Yet Condé and Ouattara say constitutional changes have reset the clock on the number of terms in office they are legally allowed — claims their opponents have loudly rejected. Neither has shown signs of backing down weeks before voters are to head to the polls.

Unrest could provide an opportunity for militants who are already creeping toward the coastal states. Ivory Coast, for instance, endured its deadliest attack in four years this summer when suspected al-Qaeda loyalists ambushed an army outpost near the country’s northern border, killing 14 soldiers.

“These violent people build on local disagreements,” said Mathias Hounkpe, who leads the political governance program at the Open Society Initiative for West Africa, a pro-democracy group in Dakar. “Security forces will be mobilized to control the political situation instead of looking for extremist hot spots.”

The extremists put down roots in Mali nearly a decade ago after the collapse of the Libyan government and gained influence by exploiting ethnic clashes — using a strategy of picking sides and offering protection.

They have since spread into Niger and Burkina Faso, where the number of attacks has more than doubled in the past year.

The conflict killed at least 4,825 people in 2019, according to a tally by the Armed Conflict Location & Event Data Project, and the death toll this year had reached 5,365 by October, driven in part by the armed responses of state security forces.

Economic damage from coronavirus lockdowns, meanwhile, threatens West Africa’s capacity to strike back: The regional economy, once forecast to grow by 4 percent this year, is on track to shrink by 2 percent.

“I urge us all to resist the temptation of seeking to perpetuate ourselves in power,” the Nigerian president said in his September speech, adding that West Africa “cannot afford another political crisis.”

Ivory Coast’s last political crisis triggered a civil war that killed approximately 3,000 people and forced hundreds of thousands from their homes.

That conflict erupted when then-President Laurent Gbagbo refused to step down after losing the 2010 election to Ouattara. (Gbagbo now lives in exile in Belgium.)

Ouattara pledged to leave office at the end of his second term. Then his chosen successor, Prime Minister Amadou Gon Coulibaly, died of a heart attack.

“President Ouattara is committed to passing a strong democracy on to the next generation,” Patrick Achi, the minister of state and secretary general of Ivory Coast, said in an email. “However, Gon Coulibaly’s sudden and tragic death in July, just 12 weeks before the election, changed the stakes, robbing Ivory Coast of a leader capable of maintaining the socio-economic progress of the last decade.”

Ouattara’s main opponents are former prime minister Pascal Affi N’Guessan and former president Henri Konan Bedie, and at a joint appearance Thursday, they called on their supporters to boycott the election and “block this electoral coup d’etat,” as Affi N’Guessan declared.

Former first lady Simone Gbagbo — who, like her husband, was acquitted of charges of crimes against humanity and was granted amnesty by Ouattara — has called for the election to be postponed, saying she wants the country to avoid another round of bloodshed.

Several people have died in clashes since Ouattara announced his candidacy, and hundreds have been injured.

“We must stop this,” Simone Gbagbo said in an interview. “It only hurts the people, the country.”

Ouattara’s team denied involvement in the violence.

“The president strongly condemned the unfounded accusations which suggest that the security forces have killed demonstrators,” Achi said. “He deplored the loss of life.”

In Guinea, people once praised Condé as the first president since independence in 1958 to win office through free elections.

Now critics accuse him of exploiting the pandemic to stay in power.

As West Africa recorded its first coronavirus cases in March, the Guinean leader pushed through a constitutional referendum allowing him to seek reelection. His government ordered demonstrators to stay home, citing public health measures, and deployed soldiers as enforcers. (Condé’s office did not respond to requests for comment.)

Over the past year, at least 50 people have died in clashes with security forces and counterprotesters, according to a report this month from Amnesty International.

“It is not conceivable that, in a normal country, there are so many deaths without any investigation being carried out to identify the perpetrators,” Condé’s top opponent, Cellou Dalein Diallo, said at a news conference last month in Dakar.

U.N. officials expressed alarm last week at what they described as “dangerous” hate speech ahead of Guinea’s election as ethnic group-bashing emerged in national dialogue. (Condé’s primary supporters are the Malinke people, and Diallo draws more Fulani backers.)

“We fear what comes next,” said Makalé Camara, one of the 11 candidates running against Condé for the presidency. “Even if you work for the administration, you have to submit to the president or you will be fired or jailed.”

Presidential term limits are widely considered to be cornerstones of peace.

Healthy democracies are less likely to endure violent fractures, researchers say: Nine of the 10 nations facing civil conflicts on the continent are those without term limits, according to the Africa Center for Strategic Studies in Washington.

A violent response to protests erodes public trust and distracts from other dangers, said Rinaldo Depagne, the West Africa project director at the International Crisis Group, a nonprofit organization focused on conflict resolution.

“The force you are using to repress your own people,” Depagne said, “you are not using it to control your borders.”

Borso Tall contributed to this report.