BRASÍLIA — They were idealists, united in the struggle against Brazil’s military dictators.

As democracy flourished, so did their careers. One of them, Paulo Ziulkoski, became the leader of an association of Brazilian cities. The other, Dilma Rousseff, rose even higher, becoming the president of Latin America’s largest country.

But their friendship soon fell apart. During a contentious meeting with the nation’s mayors in 2012, Ms. Rousseff rejected pleas for a share of Brazil’s soaring oil revenues. After the room erupted in jeers, Mr. Ziulkoski said, she stormed up to him, poked a finger in his face and humiliated him with a string of expletives.

“I never imagined a president could utter such words,” Mr. Ziulkoski said, noting that dozens of mayors have abandoned Ms. Rousseff and her party. To Mr. Ziulkoski, the public dressing down was the kind of rupture that symbolized “the beginning of the end for her administration.”

As Ms. Rousseff wages a last-ditch battle to stave off impeachment and save her presidency, she has accused her rivals in Congress of creating turmoil, saying they are orchestrating a coup d’état to oust her.