FILE - In this Sept. 13, 2018, photo, former President Barack Obama speaks as he campaigns in support of Ohio gubernatorial candidate Richard Cordray in Cleveland. Another political test in the coming week for Obama as the former president tries to boost Democratic candidates and party enthusiasm without also motivating President Donald Trump's supporters as the November elections near. (AP Photo/David Dermer)

FILE - In this Sept. 13, 2018, photo, former President Barack Obama speaks as he campaigns in support of Ohio gubernatorial candidate Richard Cordray in Cleveland. Another political test in the coming week for Obama as the former president tries to boost Democratic candidates and party enthusiasm without also motivating President Donald Trump's supporters as the November elections near. (AP Photo/David Dermer)

WASHINGTON (AP) — Nearly two years out of the White House, former President Barack Obama is facing another political test.

To the delight of many Democrats, he’s stepped back into the fray that former presidents often try to avoid, campaigning for Democratic candidates ahead of the midterms and blasting the political culture of the Trump era. He attracted a large, adoring crowd this past week in Ohio and will be in Pennsylvania on Friday campaigning for Democratic Sen. Bob Casey.

ADVERTISEMENT

But Obama’s return poses challenges for both the former president and his party. For one, Obama has struggled to turn admiration for him into votes when he’s not on the ballot. Democrats lost significant ground in the 2010 and 2014 midterms and his enthusiastic campaigning for Hillary Clinton didn’t carry her across the finish line in 2016. Perhaps more importantly, Obama’s public re-entry into politics could serve as a motivating factor for Republicans, potentially handing the GOP a gift at a time when they face an uphill battle to maintain their grip on Congress.

“This is perfect for us,” said Rep. Lou Barletta, the Republican challenging Casey for the Senate seat. “It will energize Republicans as a reminder.”

The former president will also “energize those blue-collar Democrats who worried about their jobs under Obama and went out to vote for Donald Trump,” Barletta added.

For their part, Democrats say an Obama visit is a huge boon. Massive crowds give candidates and the party a chance to organize, update contact lists, motivate new donors and boost volunteerism.

Michael Halle, the campaign manager for Richard Cordray, the Democratic candidate for governor in Ohio, said Obama’s visit sent a message about the stakes of the race, which could have implications for redistricting and voting rights in the future.

“First and foremost, it’s important for the people who live in Ohio,” he said. “But secondly, there are also significant national implications, and I think the (former) president weighed those in making the decision.”

An aide to the former president said Obama is aware that he does not have a strong record of aiding Democrats in midterm elections and that his presence can have the effect of galvanizing Republican voters. The aide said Obama would take a strategic approach to the midterm races and pointed to the light footprint that the former president kept earlier in his post-presidency. That’s when he recorded a get-out-the-vote robocall for Democrat Doug Jones, rather than travel to Alabama to appear with Jones ahead of his upset Senate victory. The aide cast the decision as an example of how Obama could still lend his voice in a part of the country where he is less popular.

ADVERTISEMENT

The aide lacked authorization to discuss publicly Obama’s thinking and spoke on condition of anonymity.

Scott Mulhauser, who served as Vice President Joe Biden’s deputy chief of staff during the 2012 election, said Obama left office as the “most admired man in the country, and his popularity has only increased since.”

“Part of his success is being strategic in his approach to campaigning — coordinating with campaigns to maximize his impact and minimize any blowback, stumping where it makes sense and avoiding where it doesn’t,” Mulhauser said, noting Obama’s role in the Jones campaign. “He’s rightfully out on the trail for certain campaigns, taking a pass on others and recording calls and sending emails on behalf of those that want to use him and his popularity in a targeted manner.”

In Pennsylvania, Obama returns to a state he carried twice but that swung to Trump in 2016. The state features critical contests for Congress and governor. Rep. Dwight Evans of Philadelphia, where Obama will campaign, said that the former president’s presence will be important for his ability to motivate African-American voters, college-aged voters and the poor.

“I think that he can help Democrats, and I think it needs to be really targeted,” Evans said.

Both African-Americans and college-age voters were crucial to Obama’s victories in 2008 and 2012, and because Obama was the first black president, Evans said, “he can say some things to the African-American community that cannot be said by anybody else.”

While in Philadelphia, Obama will fundraise for Senate Democrats in general and in particular, Casey, who was among Obama’s earliest Senate backers when he sought the Democratic presidential nomination in 2008.

While Obama’s full schedule is taking shape, aides say he is weighing how to best engage on behalf of Democratic candidates across the nation. Earlier this year, he endorsed more than 80 Democrats across more than a dozen states, and aides say a second wave of endorsements is expected this fall.

Brenda Boots, 42, who attended the Ohio rally, said Obama is a welcome presence and hoped he would inject the governor’s race with new life.

“How could he hurt?” she asked. “I don’t think he could hurt.”

___

Levy reported from Harrisburg, Pennsylvania. Associated Press writer Julie Carr Smyth in Cleveland contributed to this report.