Mr. Yang is seeking to become New York City’s first Asian-American mayor, but critics say that some of his past comments have fed racial stereotypes.

During a surge in attacks on Asian-Americans last spring, Andrew Yang — then recently off the 2020 presidential campaign trail — wrote an op-ed suggesting that “we Asian-Americans need to embrace and show our Americanness in ways we never have before.”

To many Asian-Americans, the message seemed to place yet another burden on victims, and it stung.

One year later, as Mr. Yang hopes to make history as New York City’s first Asian-American mayor, some New Yorkers have not forgotten that op-ed, or their sense that Mr. Yang’s remarks during the presidential campaign — describing himself as “an Asian man who likes math,” for instance — could feed stereotypical tropes.

But many Asian-Americans also see in his candidacy an opportunity for representation at the highest level of city government, an increasingly meaningful metric amid violent attacks on Asian-Americans in New York and across the nation, including the fatal shootings in the Atlanta area last week that left eight people dead, six of them women of Asian descent.

“I grew up Asian-American in New York, and I was always accustomed to a certain level of bullying, of racism, but it took a form of mockery, of invisibility, of disdain,” an emotional Mr. Yang said at a news conference in Times Square the next day. “That has metastasized into something far darker. You can feel it on the streets of New York.”

As New York’s diverse Asian-American constituencies grapple with both overt violence — the city saw three more anti-Asian attacks on Sunday — and more subtle forms of bigotry, Mr. Yang and many of the other leading mayoral candidates are racing to show how they would lead a community in crisis. They are holding news conferences, contacting key leaders and attending rallies in solidarity with Asian-Americans who have at once demonstrated growing political power and are experiencing great pain now.

But more than any other candidate, it is Mr. Yang who is in the spotlight, with the moment emerging as the most significant test yet of his ability to demonstrate leadership and empathy under pressure. He is also looking to respond in a way that will strengthen his support among Asian-Americans, a group whose backing he is counting on, while simultaneously building a broader coalition.

In recent weeks, Mr. Yang has visited a branch of Xi’an Famous Foods, a popular New York restaurant chain that has been hit hard by anti-Asian harassment. Along with other contenders he joined a rally against Asian-American hate in Manhattan late last month and participated in a vigil on Friday and other outreach efforts over the weekend.

“We have to start building bonds of connection with the Asian-American community to let them know that this city is theirs, this city is ours,” Mr. Yang said at a rally on Sunday. “One great way to do that is by electing the first Asian-American mayor in the history of New York City. Because you know I’ll take it seriously.”

Throughout the race he has made frequent visits to heavily Asian-American neighborhoods across the city, expanding his coalition of “Yang Gang” supporters, a cohort that in his 2020 campaign included many young, white men. He has also taken multiple turns on national television to discuss attacks on Asian-Americans, including an appearance with his wife, Evelyn, on ABC’s “20/20” on Friday.

Earlier this month, Mr. Yang visited Xi’an Famous Foods, a popular New York restaurant chain that has been hit by anti-Asian harassment. 
Spencer Platt/Getty Images

Mr. Yang was not, however, the first contender to condemn the Georgia shootings, tweeting late that night instead about a St. Patrick’s Day scarf, in a move that struck some observers as tone deaf. (He later said that he had not seen the news on Tuesday. He issued a series of tweets about Atlanta on Wednesday morning, before making public remarks.)

On Thursday, Mr. Yang’s voice appeared to waver with emotion as he spoke at an event convened by the Rev. Al Sharpton, the civil rights leader. Speaking in starkly personal terms, Mr. Yang discussed the importance of “seeing that Asian-Americans are human beings, Asian-Americans are just as American as anyone else.”

“I’m glad that he’s leaning in,” said Representative Grace Meng, the only Asian-American member of New York’s congressional delegation. “I felt like he was getting a little emotional. And I think that the Asian-American community likes to see more of that.”

Jo-Ann Yoo, the executive director of New York’s Asian American Federation, said there were signs that Mr. Yang was connecting in particular with younger Asian-American voters.

“They’ve said, well, nobody has invited us, drawn us into politics, we don’t see ourselves reflected in any of these spaces,” she said. “If those are the reasons Asian-American young people are not engaging, I think Yang’s done a pretty good job of leading the conversations and drawing young people in.”

But, she added, “Other non-Asian candidates should not assume that Asians only vote for Asians.”

Interviews with around a dozen community leaders, elected officials and voters suggest that the candidates who are best-known to Asian-American New Yorkers include Mr. Yang, a son of Taiwanese immigrants, and two veteran city officials: Eric Adams, the Brooklyn borough president, and Scott M. Stringer, the city comptroller.

“It’s really a test of whether people are going to lean into longer-term relationships with electeds like Eric and Scott, or are they going to base their decision, especially the newer voters, on more identity politics, like with Andrew Yang?” said Ms. Meng, who has not endorsed a candidate.

Some also mentioned interest in candidates including Maya D. Wiley, the former counsel to Mayor Bill de Blasio; Dianne Morales, who has relationships with community leaders from her time as a nonprofit executive; and Councilman Carlos Menchaca, a low-polling contender who represents a significant Asian-American population in Brooklyn. Ms. Meng also described Kathryn Garcia, a former city sanitation commissioner, as being especially proactive in her outreach.

Like every other constituency in New York, the Asian-American slice of the electorate encompasses a diversity of views on high-priority issues including education, the economy, poverty and health care. But community leaders say that the matters of security and confronting bias have plainly become among the most urgent, though there are differences of opinion around the role policing should play in combating the uptick in attacks.

“Especially during these times, it’s really important to be that candidate to show that you can empathize with the Asian-American community, that you’re reaching out actively to the community and you’re thinking of ways to bring different coalitions together,” Ms. Meng said.

In Queens, the borough with the largest population of people of Asian descent, Mr. Yang’s greatest competition for those voters appears to be Mr. Adams, a former police officer who has been vocal in calling for more resources to combat anti-Asian attacks, and who is widely seen as a strong mayoral contender despite trailing Mr. Yang in the little public polling that is available.

Hiroko Masuike/The New York Times

“Eric seems to have engaged in the broadest level of outreach in communities across the city, in particular, in Asian-American communities,” said State Senator John C. Liu of Queens, an influential voice in New York Asian-American politics.

Asked about Mr. Yang’s outreach, he replied, “I’m going to limit my comments to things I will positively say about specific candidates.”

“You can use that as my response to your specific question,” he added.

The parents of Wenjian Liu, a police officer who was fatally shot in a patrol car in Brooklyn in 2014, endorsed Mr. Adams on Sunday.

“Eric Adams was there for us when we lost our son — and he’s always been there for the Asian community, not just when he decided to run for mayor,” Wei Tang Liu and Xiu Yan Li said in a statement provided by the Adams campaign.

It’s a message that some may see as a swipe at Mr. Yang, who has lived in New York City for years — building a career in the nonprofit and start-up worlds — but has not been active in local politics until now.

At the rally against Asian-American hate late last month, Jessica Zhao, 36, said she felt torn about his candidacy. She approved of his outreach to Asian-American voters as a mayoral candidate, but she remained concerned by last spring’s op-ed, in which Mr. Yang offered a wide range of recommendations — including advising that Asian-Americans should wear red, white and blue.

Indeed, Ms. Zhao had outfitted her husband — a Navy veteran — with masks bearing the military logo out of a “desperate” concern for his safety. But she detested the notion that proof of patriotism might ward off hate crimes, and was deeply bothered that, in her view, Mr. Yang seemed to put the onus for safety on Asian-Americans under attack.

“To put even more of a burden on us — we could do even more to supposedly pacify racists enough that they won’t attack us? — really hit a nerve,” said Ms. Zhao, who is active with the Forest Hills Asian Association in Queens. “To say that he felt ashamed to be Asian, it was like the opposite of what we needed in that moment. We were so desperately hoping he could be a galvanizing voice for us.”

In an interview last week, Mr. Yang declined to say whether he regretted writing the op-ed, but said repeatedly that he was “pained” by how it was perceived.

“It pained me greatly that people felt I was somehow calling our Americanness into question when really my feeling was the opposite,” said Mr. Yang, who also pledged to be more active in New York’s Asian-American communities. “Which was, we are just as American as everyone else, and then, how can we help our people in this time when there is so much need and deprivation?”

Asked whether he had changed how he approached matters of race and identity since running for president, he paused.

“This is a very difficult time,” Mr. Yang finally said. “Our sense of who we are in this country has changed appreciably in the last number of months.”

And in the last few weeks, Ms. Zhao’s sense of Mr. Yang has changed, too, she said.

“Seeing his, I guess, evolution, in being able to properly address anti-Asian sentiment in this country, that has been encouraging,” she said. “I can tell that he brings a unique perspective of what Asians are suffering through. And that’s when representation really does come through. That’s when it does matter.”

Jeffery C. Mays contributed reporting.