Sen. Bernie Sanders on Wednesday said he’s willing to work with president-elect Donald Trump if he’s interested in pursuing policies that help Americans, but he also had a warning for him.

“To the degree that Mr. Trump is serious about pursuing policies that improve the lives of working families in this country, I and other progressives are prepared to work with him,” the Vermont independent said in a statement.

“To the degree that he pursues racist, sexist, xenophobic and anti-environment policies, we will vigorously oppose him,” Sanders added.

Get Breaking News Delivered to Your Inbox

He also tweeted Thursday.

If Donald Trump takes people's anger and turns it against Muslims, Hispanics, African Americans and women, we will be his worst nightmare. — Bernie Sanders (@SenSanders) November 10, 2016

During the 2016 presidential primaries, Sanders, as a Democratic presidential candidate, often blasted Trump for his “bigotry” and being a “pathological liar.” In his statement, Sanders said that Trump tapped into the middle class’s anger toward “establishment economics, establishment politics and the establishment media.”

“People are tired of working longer hours for lower wages, of seeing decent paying jobs go to China and other low-wage countries, of billionaires not paying any federal income taxes and of not being able to afford a college education for their kids - all while the very rich become much richer,” Sanders said.

One area of agreement between Trump and Sanders is their position on trade. Both have been opposed to the Trans-Pacific Partnership and Trump has advocated renegotiating trade deals.

Even Sen. Elizabeth Warren, D-Massachusetts, who often got into Twitter fights with Trump during the 2016 race, said she’s willing to work with him now and “put aside our differences.”

In a statement Wednesday, Warren said the integrity of U.S. democracy is more important than an individual election. She said she hopes Trump will fulfill the role of president “with respect and concern for every single person in this country, no matter who they are.”

Trump won 289 electoral votes and Hillary Clinton won 218. He or she needed 270 electoral votes to win the presidential election. Clinton, however, is leading in the national popular vote.