Former president Barack Obama is introduced as he and former first lady Michelle Obama have their portraits unveiled at the Smithsonian National Portrait Gallery on Feb. 12 in Washington. (Matt McClain/The Washington Post)

Former president Barack Obama, who has kept a low public profile since leaving the White House a year and half ago, is wading back into politics ahead of the November elections.

Obama will actively help Democrats in competitive races, aides close to him say, and he is stepping up fundraising efforts for the party.

“The simple message right now is that if people participate and they vote, that this democracy works,” Obama said Thursday night at a fundraiser for the Democratic National Committee in Beverly Hills, Calif. “The majority of the country doesn’t want to see a dog-eat-dog world where everybody is angry all the time.”

Without directly mentioning President Trump, Obama drew the contrast, saying: “To a large degree, we are seeing a competition between two stories. . . . There’s the story that is based largely on fear, and there is a story based largely in hope. There’s the story that says we’re in it together, and there’s the story that says there’s an us and a them.”

Obama added that “fear is powerful” and that Democrats have a lot of ground work to do to win in November. “I would caution us from extrapolating too much from a bunch of special elections and starting to think that, ‘Okay, this will take care of itself.’ Because it won’t.”

Obama also appeared at a Friday event in Atherton, Calif., near San Francisco, benefiting the Democratic National Campaign Committee.

On July 17, Obama will give a high-profile speech in South Africa marking the 100th anniversary of Nelson Mandela’s birth. While that speech to thousands of people is unlikely to directly address the raw political division in the United States, Obama will talk about tolerance and inclusion, organizers said.

“Mandela stood and sacrificed greatly for democratic values and the universal rights of man. At a time when those values and human rights are under assault throughout the world, this is an essential moment for President Obama to speak,” said David Axelrod, who was Obama’s chief strategist in his two presidential campaigns.

Obama’s reemergence comes at a time of rampant anger among voters in both major political parties. While Democrats are counting on the former president to boost turnout in midterm elections that will determine which party controls Congress, it remains unclear how effective Obama will be — or whether he provokes Republicans to cast ballots against his party.

During his presidency, Obama was largely unsuccessful in transferring his popularity to fellow Democrats in the midterms. Yet in 2017, he publicly backed three Democrats who successfully won office in Virginia, Alabama and New Jersey, helping them by spurring turnout by African Americans and other voters.

Many Democrats have called for Obama to speak up more at a time when many believe the country’s democratic institutions and values are under attack and its relationships with traditional allies are strained.

“I’m giving you the executive summary: Vote. Participate. Get involved,” Obama said at the Beverly Hills fundraiser, which reporters attended and where Los Angeles Mayor Eric Garcetti (D) gave remarks. “And do not wait for the perfect message, and don’t wait to feel a tingle in your spine because you’re expecting politicians to be so inspiring and poetic and moving. Politics, like life, is imperfect. But there is better, and there is worse.”

Since Trump took office, he has systematically dismantled or gutted Obama’s key initiatives, including environmental and banking regulations and key elements of the Affordable Care Act.

After leaving the White House, Obama has occasionally given speeches, including one at the John F. Kennedy Library Foundation in Boston in which he urged opposition to efforts to repeal Obamacare. But he has largely stayed above the political fray and spent considerable time meeting with world leaders abroad, writing his memoir and building up his foundation.

It has been a long-standing practice of former presidents to make themselves scarce after leaving office.

Obama is galactically popular on Twitter but has been reserved in his use of social media. With 103 million Twitter followers, Obama has near twice as many as Trump’s 53 million.

But in all of June, Obama has tweeted only three times: about National Gun Violence Awareness Day, the death of TV personality Anthony Bourdain and the Washington Capitals’ Stanley Cup championship. He also retweeted Michelle Obama’s retweet of fellow former first lady Laura Bush’s statement criticizing Trump’s “immoral” border immigration policy.

On Thursday alone, Trump tweeted twice that amount by midmorning.

Obama aides said the former president’s intent is to help cultivate new leaders in the party, which is still reeling from its loss in the 2016 presidential race.

“In order for the Democratic Party to rebuild, the next generation of leaders is going to have to lead. The president is acutely aware that when he is the limelight, that sucks away oxygen from others,” said Eric Schultz, senior adviser to Obama. “He wants to lift up and support the next generation of leaders.”

To help Democrats in the fall, Obama will tap into his large network of grass-roots supporters to help turn out the vote, aides said. The former president also plans to make appearances and endorsements in both state and congressional races.

Schultz said that Obama, who has often spoken of the need for greater civic engagement, has been “encouraged by the millions of people who have stepped up to the plate and mobilized” in marches around the country since he left office.

A Gallup poll in February found that 63 percent of people approved of the way Obama handled his job as president, while 36 percent disapproved.

In a poll last month by CNN, 56 percent of Americans said Obama was a better president than Trump has been, while 37 percent preferred Trump over Obama.

“He is the most popular Democrat by far, and probably of all national leaders in America — Republican or Democrat,” said Matthew Dowd, who was chief strategist for President George W. Bush’s 2004 campaign and is an ABC news political analyst. “To me, if he plays in the election, he is a major asset to Democrats.”

Dowd cited another benefit to Democrats of greater Obama involvement: “It basically puts the Clintons on the shelf, and that is a good thing.”

Trump constantly invokes Hillary Clinton in his attacks on Democrats, prompting regular chants of “Lock her up!” from his supporters after he refers to her as “Crooked Hillary.”

Ken Goldstein, a professor of political science at the University of San Francisco, said it is still an open question how much impact Obama will have by November.

While Obama is “wildly popular among Democrats — particularly among the Democrats they need to come out,” Goldstein noted his past difficulty in transferring popularity to other Democrats in 2010, 2014 and 2016.

Goldstein also questioned whether Obama’s “reasonable” tone would have the same effect it once did on Democrats. “People are angry, and I don’t think a lot of progressives want to hear it,” he said. “It’s like telling your spouse, ‘Calm down,’ when [they] are angry.”

Obama’s July 17 speech in Johannesburg, at the event honoring Mandela, is expected to be one of his most important appearances since he left the White House. He has been working on the speech for weeks, and Kofi Annan, a former secretary general of the United Nations and recipient of the Nobel Peace Prize, will be among the statesmen standing with him in South Africa.

Obama will talk about inequality and “working across divides,” according to a spokesman for the Obama Foundation.

Obama is also working with former attorney general Eric H. Holder Jr. on the National Democratic Redistricting Committee, a key focus of Democrats.

In Los Angeles, Obama made it clear how high the stakes are for the midterms and praised the wave of “extraordinary powerful” female candidates. He said it was time for the party to focus on the “nuts and bolts” of political organizing calls, data and voter lists.

In addition, Obama underscored the need for young people to be given more of a voice. “The most important thing we can do is to invite them in and give them power. Give them a voice. Stop talking at them and start working with them. . . . I became president because a bunch of 20-year-olds were running all around Iowa.”

Noah Smith in Los Angeles and Scott Clement in Washington contributed to this report.