As the race for Los Angeles mayor began to tighten late last year, Karen Bass, the presumptive favorite, received some notes of encouragement from a kindred spirit: Lori Lightfoot, the mayor of Chicago.

Ms. Lightfoot had successfully navigated a similar political path in 2019, becoming the first Black woman to be elected mayor of her city, much as Ms. Bass was trying to do in Los Angeles.

And even though Ms. Bass’s billionaire opponent had poured $100 million into the race and boasted endorsements from celebrities like Kim Kardashian and Katy Perry, Ms. Lightfoot urged her Democratic colleague to keep the faith in a series of personal visits and text messages.

“She was up against somebody who was very, very moneyed and was leaning into people’s fears about crime, about homelessness — frankly, very similar to the circumstances that I’m facing now in my city in getting re-elected,” Ms. Lightfoot said in an interview. “I just wanted to make sure that she knew that I was there for her.”

Ms. Lightfoot and Ms. Bass belong to an informal alliance of four big-city mayors tackling among the toughest jobs in America. They happen to be of similar mind in how to address their cities’ common problems, like violent crime, homelessness and rising overdose deaths.

They also happen to be Black: When Ms. Bass took office in December, the nation’s four largest cities all had Black mayors for the first time.

The Democratic mayors — Ms. Bass, Ms. Lightfoot, Eric Adams of New York City and Sylvester Turner of Houston — say their shared experiences and working-class roots as Black Americans give them a different perspective on leading their cities than most of their predecessors.

In interviews, the four mayors discussed how their backgrounds helped shape their successful campaigns, and how they provide a unique prism to view their cities’ problems.

“We have to be bold in looking at long entrenched problems, particularly on poverty and systemic inequality,” Ms. Lightfoot said. “We’ve got to look those in the face and we’ve got to fight them, and break down the barriers that have really held many of our residents back from being able to realize their God-given talent.”

To do so can require navigating a delicate balancing act.

Ms. Bass was a community organizer who witnessed the riots after the Rodney King verdict; Mr. Adams drew attention to police brutality after being beaten by the police as a teenager.

As a congresswoman, Ms. Bass took a leading role in 2020 after George Floyd’s death on legislation that aimed to prevent excessive use of force by police and promoted new officer anti-bias training. It was approved by the House, but stalled in the Senate, and President Biden later approved some of the measures by executive order.

In Chicago, Ms. Lightfoot served as head of the Chicago Police Board and was a leader of a task force that issued a scathing report on relations between the Chicago police and Black residents. Mr. Adams founded a group called “100 Blacks in Law Enforcement Who Care” in the 1990s.

As mayors, all now in their 60s, they have criticized the “defund the police” movement, yet have also called for systemic policing changes.

In Chicago and New York, Ms. Lightfoot and Mr. Adams have pushed for police spending increases and have flooded the subway with officers. That has invited criticism from criminal justice advocates who say they have not moved quickly enough to reform the departments.

“As a city, we have to have a police department that is successful,” Ms. Lightfoot said. “And to me, successful is defined by making sure that they’re the best trained police department, that they understand that the legitimacy in the eyes of the public is the most important tool that they have, and that we also support our officers — it’s a really hard and dangerous job.”

Mr. Adams agreed. “We can’t have police misconduct, but we also know we must ensure that we support those officers that are doing the right thing and dealing with violence in our cities,” he said.

The four mayors have highlighted their backgrounds to show that they understand the importance of addressing inequality. Mr. Adams was raised by a single mother who cleaned homes. Ms. Bass’s father was a postal service letter carrier. Ms. Lightfoot’s mother worked the night shift as a nurse’s aide. Mr. Turner was the son of a painter and a maid.

Maurice Mitchell, the national director of the Working Families Party, a prominent left-leaning group, said the mayors’ lived experience was all the more reason for them to “take a more expansive view of Black life that is expressed in their policies and in their budgeting,” and to prioritize schools, libraries, youth jobs and mental health care.

“We want our communities invested in, in the way that other communities are invested in and the investment should not simply come through more police,” he said.

The four serve as only the second elected Black mayors of their respective cities. New York, Los Angeles and Chicago each went more than 30 years between electing their first Black mayor and the second; Houston went nearly two decades.

The mayors have worked together through the U.S. Conference of Mayors as well as the African American Mayors Association, which was founded in 2014 and has more than 100 members — giving the four Black mayors an additional pipeline to coordinate with other cities’ leaders.

“Because we’re still experiencing firsts in 2023, it’s our obligation that we’re successful,” said Frank Scott Jr., the first elected Black mayor of Little Rock, Ark., who leads the African American Mayors Association. “It’s our obligation that to the best of our ability we’re above reproach, to ensure that we’re not the last and to ensure that it doesn’t take another 20 to 30 years to see another Black mayor.”

Of the four, Ms. Bass, a former chairwoman of the Congressional Black Caucus, is perhaps the most left-leaning, characterizing herself as a “pragmatic progressive” who said she saw similarities between Representative Alexandria Ocasio-Cortez and herself as a young activist.

“That’s who I was — that’s who I still am,” Ms. Bass said. “It’s just that, after a while, you want to begin to make a very concrete difference in people’s lives, as opposed to your positions and educating.”

On her first day as mayor, Ms. Bass won praise for declaring a state of emergency on homelessness that gives the city expanded powers to speed up the construction of affordable housing. She also supports legislation by the Los Angeles City Council, known as “just cause” eviction protections, that bars landlords from evicting renters in most cases.

A similar law in New York has stalled in the State Legislature, though supporters are hoping to pass it this year and have called on Mr. Adams to do more to help them.

All the cities share a homeless crisis, as well as potential solutions. Houston has become a national model during Mr. Turner’s tenure for a “housing first” program that moved 25,000 homeless people directly into apartments and houses over the last decade.

Now New York City is starting a pilot program based on Houston’s approach that will move 80 homeless people into permanent supportive housing without having to go through the shelter system.

Mr. Turner, a lawyer who became mayor in 2016, said he called Mr. Adams after he won a close primary in New York in 2021 to offer his support. He defended Mr. Adams’s plan to involuntarily remove severely mentally ill people from the streets — a policy that has received pushback in New York.

“I applaud him on that,” Mr. Turner said. “Is it controversial or some people will find controversy in it? Yes. But what is the alternative? To keep them where they are?”

Mr. Turner, who is in his final year in office because of term limits, said he set out with a goal of making Houston more equitable. “I didn’t want to be the mayor of two cities in one,” he said.

“I recognized the fact that there are many neighborhoods that have been overlooked and ignored for decades,” he later added. “I grew up in one of those communities and I still live in that same community.”

Anxiety among voters about the future of their cities could make it difficult for the mayors to succeed. Ms. Lightfoot, who is seeking a second term, faces eight opponents when Chicago holds its mayoral election on Feb. 28, and her own campaign shows her polling at 25 percent — well below the 50 percent she would need to avoid a runoff.

Mr. Adams, a former police officer who was elected on the strength of a public safety message, has seen his support fall to 37 percent as he enters his second year in office, according to a Quinnipiac University poll.

Concerns about crime are affecting both mayors. Chicago had nearly 700 murders last year, a major increase from about 500 murders in 2019 before the pandemic. In New York City, there were 438 murders last year, compared with 319 in 2019.

In March, Mr. Adams met with Ms. Lightfoot while visiting Chicago for a fund-raiser at the home of Desirée Rogers, the former White House social secretary for President Barack Obama. At a joint news conference with Ms. Lightfoot, Mr. Adams reiterated his position that the communities most affected by policing abuses also tend to need the most protection.

“All of these cities are dealing with the same crises, but there’s something else — the victims are Black and brown,” Mr. Adams said.

Of the four mayors, Mr. Adams, in particular, has sought to align his colleagues behind an “urban agenda,” and to call in unison for federal help with the migrant crisis.

Mr. Adams has also argued that the mayors’ messaging should be a model for Democratic Party leadership to follow, rather than what he called the “woke” left wing that he has quarreled with in New York.

“The Democratic message was never to defund police,” he said, adding: “We’re just seeing the real Democratic message emerge from this group of mayors.”