ERIE, Pa. — President Trump rallied his supporters in northwestern Pennsylvania on Wednesday evening by proudly ticking through a checklist of how he sees his record, despite Hurricane Michael barreling toward several states.

Trump’s decision to appear in this industrial area of a state he won in the 2016 election underscored his desire — and the GOP’s growing need — to energize the party’s voters in key battleground states just weeks ahead of the midterm elections.

But the hurricane hovered at the start. Addressing a crowd of supporters at the Erie Insurance Arena, Trump began by offering “our thoughts and prayers of our entire nation” to those in the hurricane’s path and announced that he would be traveling “very, very shortly” to Florida, which has been hard hit by the storm.

Trump pledged that the government “will spare no expense and no resource to help these fellow citizens of ours.”

Politics followed quickly as Trump turned to familiar partisan themes while the raucous crowd of supporters in red caps and T-shirts roared. Trump touted the confirmation of Supreme Court Justice Brett M. Kavanaugh and warned that Democrats would raise taxes and “impose socialism.”

“Republicans are the party of law, order and justice, and we are also the party of jobs, jobs, jobs,” he said.

Trump, who eked out a narrow victory in Pennsylvania during the 2016 presidential race, was campaigning for a slew of Republicans who are facing uphill challenges this year, including gubernatorial candidate Scott Wagner and Rep. Lou Barletta, who is running for the Senate.

Speaking at a rally in Erie, Pa. on Oct. 10, President Trump said he intends to travel to Florida as Hurricane Michael hits the Panhandle. (The Washington Post)

Trump had faced questions earlier Wednesday about whether it was appropriate to hold the rally as Hurricane Michael, a Category 4 storm, was slamming into Florida’s Gulf Coast.

Upon landing in Erie, Trump told reporters that it would be “very unfair” to cancel the campaign event.

“You have thousands of people who started coming last night,” Trump said. “So we’re going to do that and we have a lot of happy people.”

Ahead of the rally — the second of four this week — Trump also tweeted a photo that appeared to have been taken by CNN’s Jim Acosta showing attendees lining up to get into the venue. “Couldn’t let these great people down,” Trump said in the tweet.

En route to Erie, White House spokeswoman Lindsay Walters told reporters that Trump was making calls to governors whose states were affected by the storm.

“He has a great team on the ground in Washington and in air and in Florida and will be monitoring the hurricane and coordinating with local partners,” Walters said, adding that Trump plans to travel to Florida early next week.

During the flight to Erie, Trump spoke by phone with Georgia Gov. Nathan Deal (R) and Alabama Gov. Kay Ivey (R), Walters said.

In his rally remarks, Trump touched on the apparent cultural divide in the wake of Kavanaugh’s confirmation, which has sparked new debates over gender and the #MeToo movement. He mocked the “rules” of the #MeToo movement at one point as he told a story about his past Pennsylvania campaign.

“There’s an expression, but under the rules of Me Too, I’m not allowed to use that expression anymore. I can’t do it,” Trump said, although it was unclear what he was referencing.

Trump spent extensive passages of his speech reliving his 2016 victory in vivid detail, bemoaning the news media, with “fake news” swipes along the way. At one point, the crowd began to chant, “Lock her up!” when Trump’s 2016 opponent, Democrat Hillary Clinton, was mentioned.

Highlighting individual politicians up for reelection who have been strong supporters was a priority: Trump brought up Rep. Mike Kelly (R-Pa.), and his wife, Victoria, to the stage. Kelly, a former football player, rallied the crowd for minutes, ending with a plea to “go win!”

In Pennsylvania’s Senate race, Barletta, a Trump ally who shares the president’s hard-line views on immigration and trade, has found it difficult to climb closer to Sen. Robert P. Casey Jr. (D) in the polls. Casey, who is part of a well-known family in state politics, has worked diligently over the past year to engage labor voters and has echoed many of Trump’s protectionist positions on trade.

Barletta also took the stage at Wednesday’s event and said that Casey would “stop” Trump’s agenda and has “forgot about Pennsylvania.”

Casey’s latest populist tilt, coupled with high motivation among progressive activists against Trump and increasing unease among some suburban voters about the president’s disposition, has made him a tough contender; he has significantly raised more campaign funds than Barletta, a four-term GOP congressman.

“Casey has run five times statewide for three separate offices in the past 15 years, winning all in a landslide. He is a formidable opponent,” G. Terry Madonna, a veteran nonpartisan analyst and professor of public affairs at Franklin & Marshall College, and political analyst Michael Young wrote this week. “Barletta has found himself caught in a perfect storm: a confluence of hostile political winds relentlessly battering his campaign.”

“I think 12 years is enough time,” Barletta told a local radio station on Wednesday. “I think people have given him [Casey] a chance to do something.”

Barletta has hoped that the confirmation of a new Supreme Court justice would electrify Trump’s core voters in Pennsylvania. But he was not always a fervent supporter of Kavanaugh and had been pulling for Pennsylvania federal judge Thomas Hardiman to be picked, with the thought that a nominee from his state would draw more voter interest.

“No question Hardiman would have helped me in my race,” Barletta told The Washington Post in July. “I’m disappointed.”

Sonmez reported from Washington.