LOS ALTOS HILLS, Calif. (AP) — Former President Barack Obama warned Democrats on Thursday against adopting “purity tests” in the presidential primary and said any adversity the candidates face in the contest will make whoever emerges an even stronger nominee.

Obama spoke to about 100 donors during a question-and-answer session with Democratic National Committee Chairman Tom Perez in Los Altos Hills, California. The event came a day after the fifth Democratic presidential primary in Atlanta and as the 17-person field continues to expand, with the expected entry of former New York City Mayor Michael Bloomberg in the coming days.

Until recently, Obama largely refrained from opining publicly on the Democratic contest, and his move from the sidelines comes at a moment of deep uncertainty for the party. Many are jittery about the uneven candidacy of his former Vice President Joe Biden, questioning whether Sens. Bernie Sanders and Elizabeth Warren can defeat President Donald Trump next year, and skeptical of whether Pete Buttigieg, the South Bend, Indiana, mayor who is surging in Iowa, can appeal to black voters that are a crucial Democratic voting bloc.

“We will not win just by increasing the turnout of the people who already agree with us completely on everything,” Obama said. “Which is why I am always suspicious of purity tests during elections. Because, you know what, the country is complicated.”

Obama urged Democrats to “chill out,” saying, “The truth of the matter is that every candidate on that stage believes we should provide” better health care and education and address climate change.

He also noted the historic diversity of the Democratic field, which now includes five women, three black candidates, a Latino man and a gay man. He compared that to his own election as the nation’s first black president.

“We have a number of women candidates and we have one gay candidate. And those candidates are going to have barriers if they win the nomination, or they win the general election — just like I did,” Obama told donors. “You can overcome that resistance if the way you are framing these issues and messages indicate, ’Look, I’m part of an American tradition … of opening up opportunity.”

In recent weeks Obama has sought to play both referee and uplifting elder statesman. He’s cautioned “woke” activists against embracing “cancel culture” and urged the party to not adopt positions that could cost them in the general election.

“That’s not bringing about change,” he said during a recent Obama Foundation event. “If all you are doing is casting stones, you’re probably not going to get that far.”

At the same time, he has offered reassurances that a spirited primary will make the eventual nominee a stronger candidate.

It comes amid a fierce intraparty debate that has divided centrists and an ascendant progressive wing, which has advocated for policies like free college tuition and “Medicare for All” that would dramatically reshape the role of government in peoples’ lives.

Elections are ultimately won by offering a message that appeals to voters across the demographic spectrum, Obama said.

“We should not be somehow thinking either we’re going for our base voter of young hipsters and African Americans and single women versus Joe lunch-pail, hard-hat guy,” he said. “Because you know what? … I’ve had conversations with all those groups, and they share common dreams and common hopes and a vision for what a fair, just America would look like.”

The fundraiser Thursday was held at the home of Karla Jurvetson, a prominent Democratic donor and Silicon Valley philanthropist. The event raised more than $3 million for the Democratic National Committee, according to a senior party official.