Jesse Arreguin was elected as Berkeley’s new mayor with just under 52 percent of the vote Tuesday, making him the city’s first Latino mayor and the youngest in recent history.

The victory for Arreguin, who earned the major endorsement of Sen. Bernie Sanders and was a frontrunner in the mayoral race, marks a triumph for his youth-driven grassroots campaign which advocated for strong progressive policies. The late-night win came after seven rounds of ranked-choice voting distributions, since Arreguin won less than a majority with about 47 percent of the vote after all precincts reported.

The night also comes as a blow for main challenger Laurie Capitelli, widely considered the race’s frontrunner, who earned about 37 percent of the vote after votes were redistributed. A figure of the Berkeley political establishment, his solid base of local support and regional funding proved unable to best Arreguin.

“Thank you all so much for your support and together let’s move Berkeley into a new generation of progressive leadership,” Arreguin said at his election results viewing party as early returns showed him in the lead.

But the unexpected victory of Republican nominee Donald Trump for U.S. President overshadowed celebrations on Tuesday. At their respective viewing parties that night, both Arreguin and Capitelli said that the election of Trump went against the values of Berkeley as a progressive city. Hundreds of students and residents later marched through Berkeley and Oakland in protest.

“Maybe we are entering dark times, but that is all the more reason that Berkeley will be a beacon in the dark,” Arreguin said. “That is what I’ll do for the next four years.”

Over the course of his campaign, Arreguin had largely trailed Capitelli in funding. Capitelli benefited from not only a large pool of donations from individual residents but also significant independent contributions from groups representing the interests of the real estate industry and Berkeley police. But Arreguin was persistent in getting young voters, particularly UC Berkeley students, to turn out and vote for him.

For many, the election of Arreguin signals a major shift away from the current leadership of Berkeley. Mayor Tom Bates, a veteran East Bay politician who served as the city’s mayor for 14 years, had endorsed Capitelli for mayor. After being reelected to his fourth term as mayor in 2012, Bates noted that this term would be his last.

Capitelli has often branded himself as a pragmatic progressive politician who works to facilitate negotiations and form broad coalitions to unify and pass successful policies. He gained widespread praise after helping lead Berkeley to become the first city in the United States to pass a tax on sugar-sweetened beverages in 2014, despite more than $2 million poured into the election by the opposition of the tax.

“(My supporters) worked really hard and I’m proud of the race we ran we took the high road the whole time,” Capitelli said at his election results viewing party. “I plan to take a deep breath.”

This year’s election saw a diverse group of eight candidates vie for mayor, with experiences and concerns as varied and unique as the Berkeley community itself. As of press time, city councilmember Kriss Worthington earned about 8 percent of the vote, entrepreneur Bernt Wahl about 2.84, UC Berkeley graduate student Ben Gould about 2.8, community activist Zachary Runningwolf about 2.6, homeless resident Guy “Mike” Lee about 1.5, and retired senior citizen Naomi Pete about 0.6.

“I think (the campaign) went really well,” Lee said. “I think we made a real difference in the community and that was our whole goal.”

During the election campaign, Arreguin and Worthington encouraged voters to rank them both to capitalize on Berkeley’s ranked-choice voting system in Berkeley. Because Arreguin did not receive 50 percent of the vote, the second- and third- ranked votes of candidates who earned the least number of votes must be distributed until a majority is reached.

While the system did not influence the 2012 election when Bates won with about 55 percent of the vote, the collaboration between Arreguin and Worthington — who are frequently the progressive minority vote in City Council and ran on similar platforms —helped promote a unified message of progressivism to the electorate.

Arreguin has been representing City Council District 4 since 2008. Prior to that, as a UC Berkeley student, Arreguin was director of the ASUC City Affairs Lobby and Housing Commission in 2004 and as a 20-year old, he was elected to the Rent Stabilization Board. Arreguin’s seat will now be up for grabs in a special election.

“I’m surprised with how it’s come out (but) I’m proud of the race I ran,” Gould said of the mayoral election results. “I’m planning to run for Arreguin’s seat. … I’m excited to potentially be the second grad student on the council in history.”

As Arreguin prepares to lead the city into new leadership, many candidates say Arreguin has a long road ahead of him to make Berkeley a more equitable city for all its residents.

Arreguin’s biggest focus moving forward will be addressing the city’s dire housing shortage with an emphasis on building affordable units, as well as tackling homelessness and further raising the minimum wage.

“I would be deeply amazed and humbled if I won, due to not only having great endorsements like Sanders, but also to an amazing field campaign (that) canvassed every corner of the city,” Arreguin said when precincts were still reporting. “I’m not declaring victory, but it looks promising.”

Senior staff writers Jessica Lynn and Brenna Smith, and staff writer Pressly Pratt contributed to this report.

Alexandra Yoon-Hendricks is the city news editor. Contact her at [email protected] and follow her on Twitter at @ayoonhendricks.