DeRay Mckesson, whose activism over the last year and a half has vaulted him from obscure Twitter sage to a political force in the national Black Lives Matter movement, announced Wednesday that he was running for mayor of Baltimore.

His entry is a step into the mainstream for a national movement that has been criticized for a lack of organized structure and tactics. His candidacy is sure to jolt the political and protest communities at a time when activists have eschewed traditional politics and sought to work outside the system.

Mr. Mckesson, a Baltimore native who will run as a Democrat, faces an uphill climb.

He is diving, relatively late, into a crowded race of about a dozen candidates. Among them are prominent black leaders including Nick J. Mosby, a city councilman and the husband of the prosecutor who is trying six police officers in the death of a young black Baltimore man last year, and Sheila Dixon, the former mayor who remains popular even though she left office after a conviction on fraud charges. David L. Warnock, a prominent businessman, also is vying for the nomination.

The Democratic victor of the primary on April 26 is almost assured of winning the general election for an office that the party has controlled for nearly half a century.