Former NAACP President Ben Jealous won the Maryland Democratic gubernatorial primary Tuesday, defeating seven other challengers vying for the nomination.

Jealous led Prince George's County Executive Rushern Baker 39.6 percent to 29.7 percent shortly after Jealous declared victory at about 10:30 p.m., according to The Baltimore Sun. He and Baker had been the front-runners in the race for the better part of two months, according to polls.

Jealous will face popular Republican incumbent Larry Hogan in the general election on Nov. 6. He acknowledged his tough road ahead in facing Hogan after his victory Tuesday night.

"I know there is skepticism that Larry Hogan can be beaten," Jealous wrote in a press release. "Well, we've got a message for those who think this race is already over. Larry Hogan is going to lose in November because he is not ready to run against someone who knows how to build a true people-powered grassroots campaign."

Jealous, a civil rights activist with no experience in political office, defeated a crowded Democratic field — Baker, former Michelle Obama policy adviser Krish Vignarajah, state Sen. Rich Madaleno (D-Montgomery), attorney Jim Shea, tech entrepreneur Alec Ross, Baltimore business owner James Jones and high school political science teacher Ralph Jaffe.

Jealous lost out in Prince George's County to Baker, according to unofficial results posted on the county's board of elections website. But at the University of Maryland's Stamp Student Union polling place, Jealous was the popular choice. He received 25 of the 43 votes cast at Stamp, while Baker garnered 11, according to posted results.

Jealous endorsed Bernie Sanders and campaigned for him during the Vermont senator's unsuccessful 2016 presidential campaign. His nomination could signal a progressive swell among Maryland Democrats, who overwhelmingly chose Hillary Clinton over Sanders in the 2016 presidential primary.

Jealous has branded himself as a tough-talking progressive in the mold of Sanders and adopted several of the senator's policy proposals, including Medicare for all and a $15 minimum wage. He's also said he would legalize marijuana, expand mass transit and fund universal pre-K.

Sanders endorsed Jealous last summer and stumped for the former NAACP head this month, calling him "one of those leaders who is not going to be nibbling around the edges, but understands we have got to transform the economic and political life of this country," according to The Associated Press.

The primary race lacked significant controversy early on, as most of the candidates opted to attack Hogan rather than go after each other. That changed after the sudden death of Baltimore County Executive Kevin Kamenetz last month, when his running mate Valerie Ervin announced she would run in his stead.

In a May radio interview, Ervin accused Jealous of trying to prevent her from joining Kamenetz' ticket in February and getting her fired from her job as policy director for the Working Families Party, a group that endorsed Jealous last year. The Jealous campaign denied the claims.

"They've been just up to shenanigans before I even got on the ticket," Ervin told the Sun.

In recent weeks, with Jealous and Baker leading the pack, Jealous began attacking the county executive over several scandals in the Prince George's school system under his watch.

School board members have accused the county of artificially increasing graduation rates by changing students' grades. An audit released in November found thousands of students' grades were changed shortly before graduation, The Washington Post reported. In the wake of the audit, Baker expressed his support for school system CEO Kevin Maxwell, who later resigned.

Additionally, members of the county school board claimed in March some school system staff were given unapproved pay raises. County-level audits found evidence to support those claims, but David Byrd, a Baker campaign consultant, told the Sun that the county should be given credit for discovering the alleged wrongdoing.

In 2008, Jealous was elected NAACP president at age 35, the youngest person to ever hold the position. He helped to revitalize the organization as it faced financial problems, before stepping down in 2013 to spend more time with his family.

In addition to Sanders' endorsement, Jealous received the support of several high-profile political figures, including U.S. Sens. Kamala Harris (D-Calif.) and Cory Booker (D-N.J.) and New York City Mayor Bill de Blasio. He was also endorsed by the Sun's editorial board and the Maryland State Education Association, the state's largest teachers union.

The Diamondback's editorial board endorsed Jealous for governor earlier this month.

Baker had some notable endorsements of his own, including former Maryland Gov. Martin O'Malley, U.S. Sen. Chris Van Hollen (D-MD) and the Post's editorial board.

Senior staff writer Christine Condon contributed to this report.

This story has been updated.