Black community leaders say U.S. Sen. Elizabeth Warren should have stayed out of Boston’s mayoral race instead of endorsing Mayor Martin J. Walsh in a decision they say is a snub to minority neighborhoods.

Warren, in an endorsement rally at Doyle’s Cafe in Jamaica Plain yesterday, pledged to stand with Walsh over his challenger, City Councilor Tito Jackson, though he had previously campaigned for her.

“I love Tito. And have worked with Tito for a long time and I hope that Tito is going to have an important role going forward in public service,” Warren told reporters. “But Marty has shown us for four years what it is that he can accomplish, and what it is going forward that he is determined to accomplish. So, I’m here with Marty.”

Warren’s decision irked some of Boston’s black leaders who said it would have been wiser to stay out of the race between two progressive Democrats — a race Walsh is already heavily favored to win.

“It’s a bit of a surprise that the senator would enter into the contest at this stage of the game. The high road would have been to stay neutral,” said Darnell Williams of the Roxbury-based Urban League of Eastern Massachusetts. “The black community will be somewhat reflective because the senator is going to be running for re-election. And some people may say, ‘When we needed you, you weren’t there.’ ”

Larry Ellison, president of the Massachusetts Association of Minority Law Enforcement Officers, added, “This is one she probably could have sat out. I don’t think he (Walsh) needed her help in this race. I’ve been getting a lot of calls from people in the communities of color and they haven’t been really happy about it.”

Priscilla Flint Banks of Dorchester’s Black Economic Justice Institute, stressing that she was voicing her own opinion, said, “I’m very disappointed in her. As far as I’m concerned, she’s just like the rest of them — the ones who say they’re going to do so much for our community and don’t.”

Jackson, who campaigned for Warren during her 2012 Senate run, told the Herald yesterday, “I respect Sen. Warren and the work that she does. I don’t agree with her, and I think she’s wrong in this race. … My issue is not about elected officials who already have a job. I want to deal with the 10 percent unemployment rate in Mattapan. I want to deal with the fact that it’s $2,100 for a one-bedroom apartment in the city of Boston.”

Warren said she and Walsh share “core values” while she spoke of Walsh’s commitment to opportunities for all, including low-income residents and minorities, and his opposition to President Trump’s travel ban on certain majority Muslim nations. Warren also mentioned how the Trump administration could try to deport the 800,000 so-called “dreamers” brought to this country by their parents who entered the country illegally.

Walsh said, “People might say why would you bring Elizabeth Warren out? … There is a lot at stake in this election to protect what we have in our city and to take that on a national stage and to protect people on a national stage.” He called Warren’s re-election in 2018 a “No. 1 priority here in Massachusetts.”

Horace Small, of the Union of Minority Neighborhoods in Jamaica Plain, said Warren benefits from endorsing Walsh because Walsh can help her land the labor vote and other important constituent groups in her 2018 re-election race.

“It’s as much to help her than it is to support Marty. She has at least a year and a progressive and positive voting record to point to people that she’s in black people’s corner. It’s what you do when you play the averages.”