SARAJEVO, Bosnia and Herzegovina — Just before Bosnia’s presidential elections on Sunday, the separatist Serb leader Milorad Dodik made sure to pay a public visit to one of his most important backers: President Vladimir V. Putin of Russia.

Mr. Dodik dropped in at a Formula 1 Grand Prix race in Sochi, on Russia’s Black Sea coast, where the two men were photographed shaking hands last week and Mr. Putin wished Mr. Dodik “good luck” in the voting. Mr. Dodik proudly noted that the elections fall on Mr. Putin’s birthday.

He gave the Russian leader a pin as a present, but his real gift to Mr. Putin seems to be doing whatever he can to undermine the fragile state institutions that hold ethnically divided Bosnia and Herzegovina together — a goal shared by another ethnic nationalist in the race, the Croat leader Dragan Covic.

“Bosnia is hanging by a thread, and Dodik and Covic want to cut it,” said Reuf Bajrovic, a leader of the Civic Alliance of Bosnia.