PITTSBURGH — Still reeling from the horror and grief after Saturday’s massacre at the Tree of Life synagogue, Pittsburgh is now dealing with something else: the barbed politics of the 2018 midterms and widespread opposition to President Trump’s plan to visit here Tuesday.

Jewish leaders said that President Trump was not welcome in Pittsburgh and accused him of stirring up extremism.

Mayor William Peduto, who strongly rejected Mr. Trump’s suggestion that armed guards in houses of worship are the answer to violence, warned that the president would be a distraction from funerals taking place Tuesday.

Many in the Jewish community in Pittsburgh cited what they saw as the president’s divisive rhetoric, which they feel had a role in enabling the violence here, as well as other recent episodes including the mail bombs sent from Florida to prominent Democratic figures and what appears to be the racial killing of two black shoppers near Louisville, Ky. Interviews in Florida reflected a similar urgency and unease about the intersection of violence in American life and the looming midterm elections.