Ending months of self-imposed restraint, former president Barack Obama delivered a blistering critique of President Trump and Republican politics Friday, one that prompted a back-handed dismissal by the man who now occupies the Oval Office.

Over the course of an hour-long address, Obama left little doubt about the severity of his concerns over Trump’s approach, which he referred to obliquely as “this political darkness.” He compared Trump to foreign demagogues who exploit “a politics of fear and resentment and retrenchment,” appeal to racial nationalism and then plunder their countries while promising to fight corruption.

“This is not normal. These are extraordinary times, and they are dangerous times,” Obama said during the speech at the University of Illinois at Urbana-Champaign. “But here is the good news: In two months we have the chance — not the certainty, but the chance — to restore some semblance of sanity to our politics.”

Former president Barack Obama urged an audience of college students at the University of Illinois, Urbana-Champaign campus on Sept. 7, to vote. (Reuters)

Minutes after his predecessor unleashed his strongest repudiation yet, Trump responded jocularly.

“I’m sorry I watched it, but I fell asleep,” he said. “I found he’s very good. Very good for sleeping.”

Later, Trump returned to the sentiment during an event in Fargo, N.D. “Isn’t this much more exciting than listening to President Obama speak?” he asked the crowd.

The back and forth between the two titular figures of American politics — each with an unparalleled capacity to both attract his party’s voters and energize the opposition — signaled a dramatic escalation ahead of November’s elections for the House, Senate and other positions.

Obama, kicking off weeks of voter turnout efforts, argued that his aim was not to get into a presidential spitting match but to convince voters across the ideological spectrum that the conditions that gave rise to Trump’s election were a pressing threat and must be battled directly with increased citizen participation in politics. “It did not start with Donald Trump,” Obama said. “He is a symptom, not the cause.”

Former president Barack Obama heavily criticized the Republican party during a speech at the University of Illinois, Urbana-Champaign campus on Sept. 7. (Reuters)

That did not stop him from denouncing actions that Trump has taken that Obama said undermine American progress, from the ban on travelers from certain Muslim countries to the failure to take action beyond sending “thoughts and prayers” after recent school mass shootings. He criticized Trump’s attacks on the media, his decision to withdraw from the Paris climate accords, and his government’s response to the 2017 hurricane in Puerto Rico.

“I know there are Republicans who believe government should only perform a few minimal functions but that one of those functions should be making sure nearly 3,000 Americans don’t die in a hurricane,” Obama said.

He acidly rebuked Trump for his public equivocation about white supremacists involved in a violent confrontation last year in Charlottesville.

“How hard can that be? Saying that Nazis are bad?” Obama asked.

Beyond Trump, Republicans reacted sharply to the speech, arguing that Obama’s decision to return to the political arena could work in their favor. “The more President @BarackObama speaks about the ‘good ole years’ of his presidency, the more likely President @realDonaldTrump is to get re-elected,” Sen. Lindsey O. Graham (R-S.C.) tweeted. “In fact, the best explanation of President Trump’s victory are the ‘results’ of the Obama Presidency!”

Courtney Alexander, a spokeswoman for the Congressional Leadership Fund, an outside group affiliated with House Speaker Paul D. Ryan (R-Wis.) that works to elect Republicans to the House, said she welcomed Obama to the campaign trail.

“Nothing would be better than the Obama-Pelosi team traveling the country nonstop until November, reminding voters of the failed Obama-Pelosi days of higher taxes and increased government spending,” she said.

The speech was the first indication of the re-entry the former president and his wife, Michelle, have planned ahead of the midterm elections, a move filled with peril and opportunity as the most powerful duo in Democratic politics test whether they can help handicap Trump’s presidency without also motivating his supporters to go to the polls.

Trump has consistently used Obama as a foil on Twitter to energize his voters, while Democratic incumbent senators are struggling for reelection in states where Obama has never been particularly popular. Republicans also continue to use Obama’s image in campaign ads, as in a special House election in Pennsylvania and the Senate contest in West Virginia, where the Republican candidate, Patrick Morrisey, often boasts of his efforts to stop Obama policies with lawsuits.

To avoid such traps, Obama in his post-presidency has previously chosen his spots carefully. For instance, he opted to do targeted robo-calls last year to support Democratic Sen. Doug Jones’s upset victory in Alabama instead of more high-profile public appearances.

Obama also has hewed, until now, to high-minded rhetoric that contrasts starkly with Trump’s brawling approach to politics. Obama denounced the “politics of fear and resentment” in a summer address in South Africa, and in a recent eulogy for Sen. John McCain (R-Ariz.) he seemed to take a swipe at Trump, without naming him, when he described “politics that pretends to be brave and tough, but in fact is born of fear.”

“I’m asking you to be neither blind to, nor dismayed by, reality — but motivated by it,” Obama wrote in an email Thursday to supporters of Organizing for Action, a grass-roots organization he founded. “Those who believe in democracy and civil rights and a common humanity will always have the upper hand.”

Obama had sought a post-partisan post-presidency, publicly embracing that in a series of events with former Republican president George W. Bush. And he has been wary of outshining the next generation of liberal leaders, whose success he has described as the greatest ambition of his post-presidency.

“He is acutely aware that he has a mixed record of success when his name is not on the ballot,” said one person familiar with Obama’s thinking, who spoke on the condition of anonymity to discuss internal deliberations. “We understand that we energize the other side like very few people do, so we have to be thoughtful about where we campaign.”

Over the coming weeks, Obama plans a strategy of big events in blue corners of the country, quiet fundraisers with donors and a series of digital videos or robo-calls meant to drive Democratic attention and turnout in a targeted way. A top focus of his efforts will be helping Democrats retake the House, which he will kick off Saturday with a Democratic Congressional Campaign Committee rally in ­Orange County, Calif., for the seven Democrats running there in Republican-held districts Hillary Clinton won in 2016.

He has also made a priority of helping individual candidates in governors’ and state legislative races by working closely with former attorney general Eric H. Holder Jr., who has founded a group, the National Democratic Redistricting Committee, that is focused on expanding Democratic state power in advance of the next round of congressional-district mapping. Of the 81 candidates Obama endorsed in August, 40 were running for state legislative seats.

“There is no one else in the Democratic Party that is able to focus people’s attention on an issue the way that he can,” said Patrick Rodenbush, the communications director for the Holder group, for which Obama recently sat to shoot a promotional video.

Obama will appear at a Sept. 13 rally in Ohio with Richard Cordray, a former Obama appointee who is running for governor in a state that is one of the top targets for the Holder effort. Further campaign stops will be announced later.

Organizing for Action, meanwhile, has launched a parallel effort focused largely on House and state legislative races. The group has trained 200 team leaders around the country, many of whom are focused on training groups that can volunteer for House campaigns.

Michelle Obama has opted to avoid, for now at least, any explicit candidate advocacy, choosing to throw her lot in with another new group, When We All Vote, that has been gathering celebrity endorsers in an effort to launch a major voter registration drive this month. Co-chairs of the project include the former first lady, the actor Tom Hanks and musicians Janelle Monáe, Faith Hill and Tim McGraw.

“I want every single one of you to host events in your community to get registered and to get them fired up,” Michelle Obama said in a conference call with organizers Wednesday, when she announced events she would attend this month in Las Vegas and Miami.

In his speech Friday, her husband defended his own administration from near-constant criticism by Trump, noting its killing of Osama bin Laden and its handling of the economic collapse of 2008.

“Let’s just remember when this economy started” improving, Obama said.

He drew attention as well to the current president’s attempt to, as he put it, use the Justice Department as a “cudgel” against political opponents.

“None of this is conservative,” he said. “It’s not conservative. It sure isn’t normal. It’s radical. It’s a vision that says the protection of our power and those who back us is all that matters.”

As Obama began to speak, Trump was with reporters aboard Air Force One on a flight to Fargo. In a brief interview, the president called for Attorney General Jeff Sessions to do more to defend his administration against internal critics, including the recent anonymous author of a critical op-ed in the New York Times.

“I would say Jeff should be investigating who the author of that piece was, because I really believe it’s national security,” Trump said.