ERIE, Pa. — When President Trump mocked a Democratic senator at a midterm election rally the other night, the crowd responded with one of his supporters’ favorite chants from his own campaign two years ago. “Lock her up! Lock her up! Lock her up!”

The arena boomed with shouting voices and they kept going. “Lock her up! Lock her up! Lock her up!” Mr. Trump smiled and soaked it in. Then he assailed the Democrats for becoming “an angry left-wing mob.”

From the pot-and-kettle department of politics, the president is trying to turn the tables on his opponents this fall. A master of divide-and-conquer campaigning who gives critics belittling nicknames, calls his foes “evil people” and has encouraged supporters to “knock the crap” out of protesters, Mr. Trump hopes to convince the public that his opponents are the ones who are “totally unhinged.”

The raw and raucous battle over the confirmation of Justice Brett M. Kavanaugh has given Mr. Trump and his Republican allies a new target to motivate their conservative base to turn out in the elections less than four weeks away. The women who confronted senators in elevators with stories of sexual assault and the demonstrators who protested in the Senate chamber or outside the Capitol are at Mr. Trump’s rallies now part of a leftist cabal, a dangerous rabble.