MECHANICSBURG, Pa. — Donald J. Trump unabashedly trumpeted his support for warmer relations with Russia at a campaign rally here on Monday night, acidly mocking opponents who say he is too friendly to Vladimir V. Putin, the country’s strongman president.

Mr. Trump, who has been under fire from Democrats and some conservative national security leaders for his accommodating stance toward Mr. Putin, cast his supportive remarks as a matter of practical necessity. By aligning itself with Russia, he said, the United States could more easily take on the Islamic State and other terrorist groups.