The breach quickly grew, bringing erosion to villages that had previously been shielded from it, and submerging Doun Baba Dièye. In 2009, residents started moving inland.

From his fishing boat, early on a recent morning, Mr. Diagne pointed to what was left of his former village: a few ruins on the shore, and a sunken tree covered with cormorants that used to be in the town square.

For the past several years, with financial help from the government and international organizations, he and his community have planted thousands of mangroves and pine trees known as filaos, to halt erosion and reclaim land then used to farm and sell cassava, cabbages, melons, sweet potatoes and other produce.

Mr. Diagne became a local expert of sorts on coastal erosion, even for those in Saint-Louis who had previously derided his warnings that they, too, would soon face his village’s fate.

“It was a bit hard for me in the beginning,” he said. “I received calls from people telling me: ‘Stop talking nonsense. You did not attend school. Who are you to talk about erosion and rising sea levels?’”

“But now,” he said, “people are calling me back.”