Democrat Valerie Ervin is dropping out of the Maryland governor’s race and endorsing Prince George’s County Executive Rushern L. Baker III. (Katherine Frey/The Washington Post)

Valerie Ervin is dropping out of the Maryland governor’s race and endorsing Prince George’s County Executive Rushern L. Baker III, who is locked in a tight Democratic primary contest with former NAACP chief Ben Jealous.

Ervin is the latest Maryland politician to rally around Baker since a Washington Post-University of Maryland poll last week showed him and Jealous, a first-time candidate, at the top of the crowded primary field.

Last week, former Maryland Gov. Martin O’Malley threw his support to Baker. Over the weekend, Baker campaigned with a raft of Baltimore County officials while Jealous, who has been embraced by progressive and outside groups, appeared with comedian Dave Chappelle.

In an advisory that went out late Tuesday, Ervin described Baker and his running mate, state prosecutor Elizabeth Embry, as “the right team to fight for the people of Maryland.” She said their gubernatorial ticket has “unmatched experience and passion.”

Early voting begins Thursday. The winner of the June 26 primary will challenge the popular incumbent governor, Larry Hogan, who is vying to become the first Republican chief executive in Maryland elected to a second term in more than 60 years.

Ervin, a former Montgomery County council and school board member, entered the race as a candidate for lieutenant governor. She launched her long-shot bid for the state’s top political job on May 17, a week after her running mate, Baltimore County Executive Kevin Kamenetz, died of cardiac arrest.

Democratic candidates for Maryland governor, from left: James Shea, state Sen. Richard S. Madaleno Jr., Ben Jealous, Valerie Ervin, Prince George’s County Executive Rushern L. Baker III, Alec Ross and Krishanti Vignarajah. (Brian Witte/AP)

Her gubernatorial campaign struggled from the start.

State law prohibited Ervin, 61, from using the $2 million Kamenetz raised. State election officials also said they did not have time to reprint the primary ballots to include her name at the top of the ticket. Ervin sued, but a judge denied her request to force the state to reprint the ballots.

While Kamenetz was near the top of the field in early polls, along with Baker and Jealous, Ervin was a distant third in the June 5 Post-U.-Md. survey, with support from 8 percent of likely voters.

Nearly four out of 10 likely voters had not decided on a candidate.

Mileah Kromer, a political-science professor at Goucher College, said the impact of the endorsement will depend on whether Ervin stumps for Baker in the next two weeks.

“It needs to be more than just an endorsement; it might help if she advocates for him,” she said. “I’ve always felt she’s strong on the stump. People like her in person, and she can forcefully deliver a message.”

Ervin, who recently worked as the executive director for the Center for Working Families, is a staunch progressive who supports a $15 minimum wage, universal child care for parents who can’t afford it and 100 percent renewable energy.

She is more closely aligned with Jealous on policy issues than Baker, but she and Jealous have had clashes in recent months.

In late May, Ervin publicly accused Jealous of trying to keep her from joining Kamenetz’s ticket. Jealous denied the allegation.

The progressive Working Families Party, where Ervin was working as a senior adviser when she was recruited by Kamenetz, had endorsed Jealous in the governor’s race.

Ervin plans to formally announce her endorsement of Baker on Wednesday morning in Langley Park, a town that sits on the border of Prince George’s and Montgomery counties.

Her running mate, Marisol Johnson, a former Baltimore County school board member, is expected to join her.