DeRay Mckesson was standing alone, in a hallway outside the Turner Learning Commons auditorium at the University of Baltimore, checking his phone. He was 30 minutes from appearing on stage with three of the other long-shot Democratic candidates in the crowded Baltimore mayoral race. The leading candidates in the race had debated here the day before in a well-attended and televised forum. This Wednesday morning undercard forum had almost as many candidates and moderators as voting-age members of the audience.

On Twitter, Mckesson, 30, is the most prominent voice in a grass-roots movement to ensure that black lives matter. But at this stage of the race, in late March, he’d been struggling to gain an audience in his campaign to be mayor of his hometown, where he’d filed to run at the deadline in February, surprising other candidates and many of his activist allies. He was fighting criticism that he is a carpetbagger: a creature largely of Twitter and of the places other than Baltimore where he has protested and rallied. Fewer than 1 percent of voters in the most recent Baltimore Sun poll of the race had said they were going to vote for him. He had about a month to change thousands of minds.

This work will always be more important than it is popular. — deray mckesson (@deray) April 4, 2016

Mckesson is bidding to lead a city of 623,000 that lost 344 of its people to homicide last year, is undertaking the most comprehensive set of agency audits in decades, is considering one of the largest taxpayer-subsidized developments in the country, is failing to help most young students meet college and career readiness standards and is still reeling from the death of Freddie Gray while in custody of the city’s police department last year. Mckesson is one of 13 contenders in the April 26 Democratic primary, effectively the general election in a city where eight of nine voters in 2012 cast a ballot for President Obama. (Five Republicans, four Green Party candidates, two independents and five unaffiliated candidates are also running.)

The Sun poll showed half the vote going to two longtime political insiders: former Mayor Sheila Dixon and state Senate Majority Leader Catherine Pugh. (Mayor Stephanie Rawlings-Blake announced in September that she wouldn’t run for re-election, amid low approval ratings and criticism of her leadership during the unrest after Gray’s death.)

Mckesson and many of the other candidates are trying to tap into a desire for change, citing what they say are their city government’s failings — its inability to stop the state from canceling a long-planned train line, to complete the audits to cut waste, or to protect its people from violence from one another or their police officers.

Mckesson was part of the protests calling for police accountability after Gray’s death, as he was in Ferguson, Missouri, after the killing of Michael Brown in August 2014, and a dozen other places over the past 20 months. Last August, he and fellow activists launched a set of policy proposals, Campaign Zero, that they say will help reduce police violence. And he has met with Obama, as well as Democratic presidential candidates Hillary Clinton and Bernie Sanders to press them to back Campaign Zero’s policy proposals.

The movement has fundamentally changed electoral politics, by forcing conversations about race and justice to the forefront. — deray mckesson (@deray) April 7, 2016

Yet he is building his mayoral campaign on a broader pitch: that he is not only the candidate best positioned to increase police accountability, but also the one who wants to get down and dirty with lower-profile issues, even ones as uncomfortable as cockroaches’ effect on asthma or as obscure as Environmental Protection Agency consent decrees and stormwater runoff. He says the next mayor must address problems at scale and measure outcomes. He’d assign his senior staff to meet monthly with community leaders and talk policy. “The weeds are the work,” he said.

Although he has spent most of the last year and a half as an activist, helping to build the Black Lives Matter movement, he has a credible case as an uber-wonk. Campaign Zero’s detailed policy proposals include a push for better data on people killed by police officers. His first job, which he started in 2007, was with Teach for America at a Brooklyn middle school teaching math, and while he’s not a quant, he can speak that language. He later worked as an HR executive for the public-school systems of Baltimore and Minneapolis. His statements at forums and meet-and-greets in the mayoral campaign include recitals of stats he has absorbed about adult illiteracy and about the effect of long commutes. His 26-page platform, informed by advice from local experts, is impressively detailed, more so than most other candidates’. It includes charts showing where Baltimore stands on important measures and specifies where he’d like the city to go.

But this is a noticeably wonky slate of candidates in a wonky race focused on audits and processes as much as personality and biography. In forums last month, candidates said they’d improve the city’s touted but troubled statistical management system, CitiStat, and threw around phrases such as “data-focused management,” “relational databases” and “predictive analytics.”

The other candidates mix the data talk with more traditional political rhetoric. That’s not Mckesson’s style. “If I go to a forum and say, ‘We need to fix the schools!’ that elicits a response,” he told me. “An actual answer doesn’t.” He thinks he has attended too many forums, which, in his view, have a low “bang for the buck.” He thinks he connects more with voters at small events, like meetings with supporters or experts or with constituents in their homes, than on stage in formal settings, where the crowd responds to volume and pithiness. Seven weeks into his candidacy, he was still trying to find the right balance between what way of communicating was true to himself, how he thought a candidate should act and what was best for his campaign, online and in person.

Mckesson will have to do more than the forums to be competitive in the mayoral race, said Mileah Kromer, a political scientist and director of the Goucher Poll at Baltimore’s Goucher College. “For someone relatively unknown, he’s going to have to do the full monty of everything,” she said.

“Being on the B Team sucks,” Mckesson told me after the forum. We walked out into the unseasonably warm day on our way to the city’s Washington Monument, where he was set to film a segment with Fusion TV. The interview was one of many Mckesson was doing with national media, including with me, about his campaign. He has also gotten his share of coverage from Baltimore media, but with so many candidates in the race, that share isn’t large.

The walk should take 15 minutes. It took twice as long. He stopped a half-dozen times to talk to people he knew or people who recognized him. Crossing a street, he greeted Seema Iyer, whose work on vacant homes he’d just cited at the forum. Later, a man and woman biked up to us. She said, “I just put you on my Pinterest page.” Almost as an aside, she added that she planned to vote for him.

In informal interactions like these, Mckesson is a naturally gifted campaigner. You wouldn’t know this is his first election (if you don’t count the student government races he entered and won each year from sixth grade through college). He’s unfailingly pleasant to talk to, quick to flash his infectious smile, easy to spot in his signature blue Patagonia vest.

“DeRay is such an intense listener,” said Campaign Zero co-founder Johnetta Elzie, another prominent figure in the Black Lives Matter movement who is working on his mayoral campaign. “He has a very unique talent for picking out certain parts of people’s stories and pushing them to the front.”

After dropping into a nearby coffeehouse, where Mckesson bought a sea salt chocolate chip cookie, we waited for the TV crew. After they arrived, Mckesson fell into an easy conversation with Fusion’s Dan Lieberman. He laughed and chatted and used funny voices — and then caught himself: He was being too goofy in one of the most public places of the city where he’s running for mayor. “I’m so used to being in other people’s cities,” he said. “I can do whatever I want to do. But I live here. And I’m running for mayor. Details!” The cameras switched on, and Mckesson switched into candidate mode, repeating several of his lines from the forum.

Since entering the race, he also had been unsure how to act on Twitter. His following is more than 10 times bigger than all of his opponents’ put together. It struck me when I scanned his feed before meeting with him that the vast majority of it wasn’t about the mayoral race. He made it clear over several conversations that this was no accident. He wanted to be sure not to stray too far from what brought him 330,000 followers today: a mix of updates on his activism and news and commentary on race and police violence. As a candidate, he had continued some of his Twitter traditions. He was still tweeting often, “I love my blackness. And yours.” And before signing off most nights, he tweeted, “Sleep well, y’all. Remember to dream.” But in his first month as a political candidate on Twitter, he felt less comfortable baldly stating his own views on race and police violence. And he didn’t know how his followers outside Baltimore or those mainly focused on police violence would react to pleas for financial support or local updates. (His follower count has continued to grow at about 500 per day, the same rate as before his bid, and his Baltimore posts have gotten few complaints from followers, though many also get fewer retweets and favorites than his more general commentary does.)

With nothing scheduled for a couple of hours, Mckesson went for a haircut. He thought he looked sloppy for Fusion, and his next event was also an on-camera interview, with a local youth-journalism program. We walked a few blocks to Shear Legacy. His usual barber was out, so he settled in to the chair of Leon Presbury.

Mckesson slipped into a mode he often uses when he meets people who know about his celebrity. He shared stories with Presbury about some of the impressive people he’d met through his online fame, including Obama, musicians Beyoncé and Azealia Banks, and actor Jeffrey Wright. (Closer to home, Baltimore filmmaker John Waters has endorsed Mckesson, while local author D. Watkins wrote positively about his campaign.)

In between stories, Mckesson paused to check his phone. Every once in a while, something — a pause in the conversation, a burst of notifications, a sense that too much time had elapsed — made him check Twitter. He scrolled through his timeline and notifications expertly and efficiently, lingering on a tweet that caught his eye. The fate of the tweet, whose author might have one-thousandth the following of Mckesson, hung in the balance. “I could totally not read it,” Mckesson said of his notifications. But “the power of Twitter is that I am so connected,” he said. “I’m part of the community, too.”

The day before, Mckesson had announced his fundraising through March 15, and now his feed was filling up with reaction. He thought the numbers were good news: He was near his goal of $250,000 and had the third-most donors from Baltimore of any candidate and by far the most donors overall. (Pugh and Dixon both hold more cash, and venture capitalist David Warnock’s largely self-funded campaign is spending more than everybody else, including $650,000 on TV ads.) But the vast majority of Mckesson’s donors — 95 percent — are from outside the city and include some prominent technology executives. Mckesson is the candidate of Netflix CEO Reed Hastings; of Twitter’s executive chairman, Omid Kordestani; and of YouTube’s global head of family and learning, Malik Ducard. Mckesson says that’s much better than some of his rivals’ donor bases, which include special interests in Baltimore that he thinks are more likely to expect favors than the executives of companies based elsewhere. Some of Mckesson’s critics — and even a few of his fans — disagree, interpreting the support of digital tycoons as the mark of a sellout.

Sitting in Presbury’s chair, Mckesson said he was frustrated by the blowback and wondered whether people who object to his donors think you can run a campaign for free. “It’s super-expensive,” he said. “I’m fundraising where my friends are.” (A section of his website responds to “rumors” about him, including about his funders.) He went silent when Presbury wrapped his face in a towel — to relax him and open up his pores — and then started talking again the moment the towel came off. When he wasn’t talking, he was tweeting or checking his notifications.

He paused at one. “This makes me want to scream,” he said, and handed me his phone to read a tweet that used offensive language to call him a fraud. “Who is that?” Presbury asked. “Some random person,” Mckesson said.

In between Twitter checks, Mckesson and Presbury talked about the campaign’s core issues. They discussed Freddie Gray. Mckesson said he wanted to end the rules that protect Baltimore cops from automatically being tested for drugs after they kill someone. They talked about other candidates, including Dixon, the former mayor who resigned in 2010 after accusations that she stole gift cards that were supposed to go to charity. Mckesson used a line he also says in mayoral forums: “We should forgive people for their mistakes. We should not reward them for their mistakes.”

.@TrevorNoah does an incredible Obama impersonation. And his stand-up is woke. Y'all gotta see him live. — deray mckesson (@deray) March 6, 2016

Like many people who work in the city of Baltimore, Presbury doesn’t live there and can’t vote in the race. He was impressed enough, though, to pose for a photo with Mckesson (I took it with his phone) and later post it on Instagram. (Mckesson had earlier lamented to me that Baltimore is an “Instagram city”; he has an Instagram account but uses that service, which he calls “24/7 prom,” far less than Twitter and has far fewer followers on it.) While Mckesson used the barbershop bathroom — a rare opportunity to address a basic human need on this busy day — I asked Presbury if he thought Mckesson could win. He said he wasn’t sure but thought Mckesson would end up like Bernie Sanders, a candidate of an grass-roots movement who couldn’t overcome an opponent backed by the political elite. “Money matters,” he said.

We stopped by the campaign office a few doors down from the barbershop. Mckesson confirmed with his campaign manager, Sharhonda Bossier, that he was doing an event for YouTube. “I owe you that thing for the Aspen Institute,” he remembered, referring to an event set for later that week sponsored by the foundation-funded think tank.

Mckesson is a strong believer in technology, which makes him a natural ally for the tech executives who have backed his candidacy. He has used Crowdpac to raise money online, and Jack’d, the gay men’s social network, endorsed him. He was wearing socks bearing the plaid pattern of Slack, the messaging platform. Among the interests he lists on LinkedIn are new technologies, gadgets and emergent sectors. He used to be “obsessed” with SimCity, he told Twitter co-founder Jack Dorsey in Interview magazine. “Technology is an accelerant at its best,” Mckesson said. “It creates access.”

His love of technology stems from a broader faith in the power of innovation to address all manner of social problems. For example, on the testy topic of charter schools, which Hastings backs and which many of Mckesson’s allies abhor, he doesn’t say he supports them. But he told me that he wished their critics would at least acknowledge the theory behind them, however flawed they can be in practice: “If I lower constraints, innovation increases. When innovation increases, learning increases.”

Mckesson’s campaign hasn’t been as innovative as he’d like. He has paid for polling and traditional campaign staff and highly produced campaign videos. But the major distinguishing factor of his campaign, and its competitive advantage, is Twitter. His followers are numerous and impressive. Among them are Beyoncé, John Legend, Zendaya, Rachel Maddow, Seth Rogen, Questlove, Steve Harvey, Missy Elliott and Macklemore. But just 2 percent of his followers are in Baltimore — far fewer than his follower total in New York City and about the same number as in London.

Mckesson’s followers outside Baltimore can’t vote for him, but they can help his campaign in other ways. Every tweet he sends asking for donations nets him about $1,000, he said. Each one asking for people to join his campaign’s mailing list — possible volunteers for the campaign’s homestretch — nets him about 70 people. He’s marshaling his online following to call 30,000 residents in Baltimore, a virtual phone bank capitalizing on his Twitter platform but also risking exacerbating the perception that he is not a native son.

As we transition to the 2nd phase of the campaign, we will connect with voters in a way that's never been done before in a local race. — deray mckesson (@deray) March 29, 2016

His follower count, he said, understates his platform because of his high volume of posting and all the retweets he gets: an average of 258 in the 90 days through April 6, according to social-analytics company Socialbakers. He tweeted an average of 107 times per day in March and burned the candle at both ends, averaging just six and a half hours between his last tweet of the night and his first the next morning. He says that some months, his tweets get 100 million impressions. “It’s about reach,” he said.

A much smaller number of followers could be all it takes to win the primary. The field of 13 Democratic candidates means that the next mayor could win with far fewer than half of the Democratic votes. “From a numbers perspective, 20,000 voters could be it,” he said.

The extensive media coverage and heavy spending on ads by the glut of candidates could also boost turnout, as might competitive presidential and Senate primaries. High turnout might help Mckesson if it means more young Baltimore voters go to the polls. More than 3 in 5 of his donors are younger than 34.

So far, his donations and Twitter followers haven’t paid off in the polls. The latest Sun poll, conducted from April 1 to April 4, still showed Mckesson getting support from less than 1 percent of voters.

Mckesson believes he has a chance, no matter the poll numbers. “Things can change really quickly,” he told me. In Ferguson, and nationally, “one day there were no protests,” he said. “The next day there were protests.” Before, he had 900 Twitter followers. A year later, he had 200,000.

We were already late for the interview with Baltimore middle-schoolers, so Mckesson summoned an Uber. His staff calculated that it would be cheaper for him to take Uber everywhere than to rent a car and drive himself. This arrangement also means he can monitor Twitter from the backseat. In the car, he bemoaned more negative reaction to his fundraising, including some media coverage that he said was incorrect or misleading, what he called “the downside of being clickbait.”

We arrived at the Herring Run Branch library in Northeast Baltimore. The librarian, who didn’t seem to recognize Mckesson, directed us to a room in the back. On the way there, Mckesson noticed the latest issue of the Advocate, the national LGBT magazine, with a photo of his face on the cover. He brought it over to the librarian. Intrigued, she started to read the article.

It turns out that she wasn’t expecting him because we were at the wrong library. After Mckesson called his office, we got in another Uber and soon arrived at the Waverly Branch three miles away. We were now really late. The kids were waiting around the cameras. They reacted shyly to Mckesson, reading their prepared questions off papers in their hands.

What five things would he hate to lose most? Mckesson named teaching — “one day I think I’ll be a teacher again” — reading (his favorite book is “The Giver”), his friends, his sister and his father. The questions allowed him to tell the children something about his own childhood in Baltimore. He often touts his activism in the city, which began in 1999, when he was 14 and training community leaders in organizing strategies as part of Baltimore’s Safe and Sound Campaign, which aims to improve the health and lives of the city’s children. When he was a little older, he served as chair of Youth As Resources, which distributed grant money to youth-led community projects.

Warnock, the top-spending candidate who was in third place, was also due to give an interview. When he arrived and saw his rival in the seat, he cracked, “You make the old guy follow the most articulate guy in the campaign?” Later, he and Mckesson huddled briefly, and the two agreed to do a joint event later in the campaign.

Even in a generally positive campaign, the kind words that Mckesson’s opponents have for him stand out. “I think he’s a great representative of the city,” said Carl Stokes, a city councilman. “And I appreciate that he’s in the race, so we can hear his voice.” Several, including Dixon, have even hinted that they’d consider trying to include him in their administration if they won. “I think he has great ideas,” Pugh told me. “I think he’s very smart.”

I'm mindful that the sense of hopelessness that exists, informed by experience, is deep. I also believe that we can change this world. — deray mckesson (@deray) November 3, 2015

Mckesson, like most candidates, won’t say what he plans to do if he loses. His lifestyle isn’t sustainable, he told me — he has to start earning money again. He has been staying with family friends since moving back to Baltimore after Gray’s death a year ago. He has been paid only for the occasional gig, like a teaching stint at Yale, after leaving his $110,000-a-year job with the Minneapolis public schools last March for full-time activism, and, now, campaigning. “I’m used to a predictable income,” he said.

Another Uber, to another event. On the way, we passed the Cathedral of the Incarnation, draped with a banner bearing the hashtag #BlackLivesMatter.

Mckesson’s relationship with other activists in the movement was complicated before he announced his candidacy, and some have criticized his run as a bid to enter a system that he should be fighting from without. McKesson’s candidacy isn’t an “act of progress” but “an act of co-optation and repression,” Marissa Jenae Johnson, co-founder of the Seattle chapter of Black Lives Matter, told Al Jazeera America right after Mckesson entered the race.

Mckesson’s closest allies, though, remain staunch supporters. His fellow leaders of Campaign Zero have supported his candidacy, in person and over the phone, helping to craft his platform. Elzie plans to be in Baltimore through the primary to help with the campaign. Samuel Sinyangwe, a Campaign Zero co-founder, told me that campaigning for office was “the next logical step” for Mckesson. He added that other activists, inspired by Mckesson’s example, are considering running in the next election cycle.

“Can you work within the system, or is that selling out or is that strengthening the system you’re trying to resist?” Sinyangwe said. “Those are questions that have been around for centuries. Those won’t be resolved with this campaign.”

We arrived early to an evening forum at New Freedom Baptist Church in Park Heights. Supporters of other candidates stood outside and were already filling the seats inside. Mckesson stepped back outside to check his phone. He hadn’t eaten since the cookie. “I’m starving,” he said. But his priority remained responding to his online critics. “If I don’t nip it in the bud, it trends quickly.”

As we talked, Joshua Harris, a community organizer and Green Party candidate for mayor who was also appearing at the forum, walked by. Harris’s third-party path is one Mckesson could have taken, to avoid the crowded Democratic field and potentially give himself more time before November’s general election to increase his name recognition citywide. (“I ran in the primary that offered the most possible path to victory and that was aligned with my values and beliefs,” Mckesson said.) I asked Harris if he thought he’d need 500 votes to win the Green Party primary. More like 50, Mckesson said.

We went into the church. Mckesson asked me to sit next to his bag in a seat near a power outlet so he could charge his phone. He took his seat, the third of seven candidates expected. Four seats sat empty at the scheduled start. The moderator tried to kill time. Dixon suggested that they get started. Eventually they did, with latecomers filing in. About 25 minutes into the debate, Mckesson motioned for his phone. He looked down at it at times while other candidates spoke.

Like in the morning, candidates mostly recited the parts of their campaign platforms that related most closely to each question. Stokes used his seat at the far left end to his advantage, walking around to the front of the table and moving around while answering. Mckesson stood stiffly while giving answers. He seemed tired.

But at the end of the event, he came alive, talking and laughing with people from the audience. He started recording statements by voters about him and about the forum. And he used Periscope to broadcast them live to his more than 320,000 followers.

CORRECTION (April 11, 10:17 a.m.): An earlier version of this article said that a libertarian candidate was running for mayor of Baltimore. That candidate, Doug McNeil, died April 2.