Marcelo Arruda, a municipal guard and Worker's Party (PT) official, was celebrating his birthday party in the southern Brazilian city of Foz de Iguacu, in the state of Parana, when Jorge Jose da Rocha Guaranho, entered the event and shot him dead.
The local official from Brazil's leftist opposition was shot dead on Saturday by the federal prison guard shouting support for right-wing President Jair Bolsonaro, according to a state civil police report and a witness.
Arruda, who was also armed, shot back, killing Guaranho, according to a PT statement.
The death of the two men augurs badly ahead of an October election that many expect to become highly fraught in politically polarized Brazil. Leftist former President Luiz Inacio Lula da Silva is the PT's presidential candidate and currently leads Bolsonaro in polls.
Bolsonaro, who has long railed against Lula and his leftist allies, has floated the idea of not accepting any election loss, citing unfounded claims of election fraud and problems with Brazil's widely respected electronic voting system.
According to a state civil police report and a witness who spoke with Reuters, Guaranho appeared at the party, uninvited, pointing a gun while also shouting insults at those present and words in support of Bolsonaro.
Aluizio Palmar, a journalist at the party, told Reuters that a man arrived and started screaming in support of Bolsonaro, describing him as a "legend."
According to Palmar, the man left but returned about 15 or 20 minutes later, pointing a gun at Arruda.
Arruda ordered him to stop, identifying himself as a member of the security forces.
Both men then opened fire, killing each other, according to the PT statement, the police report and security camera images in local media.
"Another dear comrade passed away this morning, a victim of intolerance, hatred and political violence," said the PT's national president, Gleisi Hoffmann, in a statement.
Bolsonaro's office did not immediately respond to a request for comment.
On social media, Bolsonaro repeated a 2018 post "refusing support from those who practice violence against opponents."
"I ask these types of people, for consistency, to change sides and support the left," Bolsonaro said in the tweet.