“It happened to all of us who worked there,” she said. “We were so dumb.”

As in the American election, it is not clear whether the Russians directly colluded with the eventual winner, Mr. Rajoelina, or simply operated a parallel campaign to support him. Before switching sides, the Russians had local hires write articles disparaging Mr. Rajoelina, according to one of the people who worked for them.

“They asked me to write bad things about Andry Rajoelina — that he sold our lands to the Chinese,” said the person, speaking anonymously for fear of reprisals. “During the second round of the presidential election, though, they asked me to write good things about Andry Rajoelina.”

Mr. Rajoelina declined to comment, but an official from his campaign said that his team was aware of Russian payments to other candidates.

In the end, the Russians retained their prize — control over the chromium operation. They now maintain a staff of 30 in the country, including engineers and geologists. The contract gives them a 70 percent stake in the venture, said Nirina Rakotomanantsoa, the managing director of the Malagasy company that owns the remaining share.

“The contract is already signed,” he said. “I am thankful the Russians are here.”

Not all the Russian operatives appeared satisfied. In a moment of doubt, Yevgeny Kopot, a Prigozhin functionary who appears to play a coordinating role for operations in different African countries, sent a text message to a colleague in Madagascar in January.

“Do you think that we’re disgracing our country?” he asked, according to texts obtained by the Dossier Center. “Or devaluing her name?”

The colleague told him not to worry. “If you think about it,” she replied, “the whole planet is disgraced. Not the planet, precisely, but humanity.”