Sen. Bernie Sanders (I-Vt.) has endorsed presumptive Democratic nominee Hillary Clinton for president.

“Secretary Clinton has won the Democratic nominating process, and I congratulate her for that,” Sanders said. “She will be the Democratic nominee for president and I intend to do everything I can to make certain she will be the next president of the United States.”

Sanders thanked those who voted for him during the Democratic primary ― especially the people of New Hampshire, where he got his first primary win, and his home state of Vermont. He also warned against presumptive Republican presidential nominee Donald Trump, arguing the business mogul would be bad for working families, calling Trump’s economic policies “reckless.”

Sanders slammed Trump’s anti-Mexican and anti-Muslim comments, claiming the GOP hopeful would divide Americans.

“In these stressful times for our country, this election must be about bringing our people together, not dividing us up,” Sanders said. “While Donald Trump is busy insulting Mexicans, Muslims, women, African Americans and veterans, Hillary Clinton understands that our diversity is one of our greatest strengths. Yes. We become stronger when black and white, Latino, Asian American, Native American – all of us – stand together. Yes. We become stronger when men and women, young and old, gay and straight, native born and immigrant fight to rid this country of all forms of bigotry.”

Clinton thanked Sanders for his support while acknowledging their former rivalry.

“Being here with him in New Hampshire, I can’t help but reflect how much more enjoyable this election is going to be now that we’re on the same side,” she said. “Now, with your help, we are joining forces to defeat Donald Trump, win in November and together build a future we can all believe in.”

She also praised Sanders for his advocacy and his ability to get people more engaged in politics, thanking him for his "lifetime of fighting injustice."

"Over the years I've gotten to know him as a colleague and a friend," she said. "His reputation for passionate advocacy hasn't always made him the most popular person in Washington. But you know what? That's generally a sign you're doing something right. And throughout this campaign, Senator Sanders has brought people off the sidelines and into the political process. He has energized and inspired a generation of young people who care deeply about our country."

Clinton had already secured the majority of pledged delegates, making her nomination all but official.

A self-described democratic socialist, Sanders was not initially seen as a threat to Clinton’s path to the White House. But the senator’s progressive message, focused on righting the wrongs of economic inequality, struck a chord with many voters.

Sanders picked up an early win in New Hampshire, a victory few pundits would have predicted months earlier. One month later, he stunned with a victory in Michigan, despite polls showing a huge lead for Clinton. That win, apparently bolstered by Sanders’ criticism of U.S. trade policy, emboldened his campaign to gun for the rest of the Midwest.

“These states in the Midwest are going to respond to us and our message in the same way Michigan workers did, and that is, ‘We need an economy that works for all of us and not just the 1 percent,’” Sanders said.

Clinton swept the March 15 primaries, however, winning Florida, Illinois, Missouri, North Carolina and Ohio. And as she continued to dominate in big states, Sanders struggled to keep up in the delegate count.

Nevertheless, Sanders held on. While Clinton took home most of the delegates in big states like Pennsylvania and New York, Sanders had a series of wins in smaller states from the end of March through mid-May. But while it remained nearly impossible for Sanders to overtake Clinton in the pledged delegate count, he vowed to stay in the race until the convention, hoping to flip unpledged superdelegates to his side.

After Trump became the GOP’s presumptive nominee, Sanders hoped to convince voters he’d have a better chance at defeating the hotel magnate in November’s general election. But as primary season came to a close, Clinton still came out on top in the delegate race.

Brian Snyder / Reuters Bernie Sanders' candidacy was far more successful than many pundits expected.

Sanders announced his presidential bid in April 2015, touting himself as a progressive alternative to the perceived inevitability of a Clinton nomination.

“People should not underestimate me,” Sanders told The Associated Press. “I’ve run outside of the two-party system, defeating Democrats and Republicans, taking on big-money candidates and, you know, I think the message that has resonated in Vermont is a message that can resonate all over this country.”

The senator gained momentum throughout the summer and fall, picking up a host of big-name endorsements including former Labor Secretary Robert Reich, Apple co-founder Steve Wozniak, economist Thomas Piketty and celebrities like Killer Mike, Spike Lee and Sarah Silverman.

Throughout the campaign, Sanders sought to convince voters that Clinton was too beholden to corporate interests to adequately represent working-class Americans, pointing to donations from Wall Street executives. He also pressed Clinton to release the transcripts of lucrative speeches she made to Goldman Sachs. Clinton, in turn, accused the senator of smear tactics, denying donations had influenced her policy positions.

Clinton and Sanders also frequently tussled over issues like health policy and gun violence. However, the key difference between the two candidates was one of vision. HuffPost’s Jonathan Cohn explained:

Hillary Clinton and Sen. Bernie Sanders (I-Vt.) were really arguing over something very basic. Can the next president eliminate, or at least weaken substantially, the political obstacles that block a liberal agenda? Sanders thinks the answer is yes. Clinton thinks the answer is no.

Paige Lavender contributed to this report.