Washington Post reporter Clarence Williams looks back on the career of D.C. Police Chief Cathy L. Lanier, who announced Tuesday that she will retire next month to take over as head of security for the National Football League. (Whitney Leaming/The Washington Post)

D.C. Police Chief Cathy L. Lanier announced Tuesday that she will step down next month to take over as head of security for the National Football League, leaving behind a legacy of community engagement that endeared her from the city’s crime-ridden neighborhoods to the broader national stage.

Lanier is ending her 26-year career after recently turning 49, and four months short of serving a full decade heading one of the nation’s highest-profile police departments. She was the District’s first permanent female chief.

“What’s more important than being responsible for public safety and security in the nation’s capital?” Lanier said. “Where do you go from here, right? When I thought about the NFL, it’s America’s favorite sport, and what’s more important than making sure America’s favorite sport is safe?”

Now one of the nation’s most influential figures in law enforcement, Lanier rose from a challenging childhood, dropping out of high school at age 14 because she was pregnant and later earning a GED, a bachelor’s degree and two master’s degrees. She has had an unusually long tenure heading a major police department, persevering through political tumult to work for three mayors.

“She’s built a fantastic force, professionalized the force, built a force that the community trusts, which is going to be a lasting legacy,” Mayor Muriel E. Bowser (D) said.

Former mayor Adrian M. Fenty (D), who promoted Lanier to chief in 2007, said she “embodies everything that is great about Washington. . . . Very few people have had more of an impact on the city than she has in her 26 years with MPD.”

Lanier was not without her critics. She has frequently clashed with the police union, which complained she had a harsh management style that drove off many rank-and-file officers. And some of her previous crime-fighting tactics, such as erecting roadblocks in high-crime areas, came under fire.

Still, she has remained one of the city’s most popular leaders. Lanier was ubiquitous in neighborhoods throughout the District, addressing residents angry over crime, hugging crying mothers of homicide victims and answering the most mundane questions on Internet bulletin boards. Community leaders had her cellphone number — and used it — and she ordered her command staff to be just as available.

On Tuesday, she sent an online note to residents: “Our patrol officers have demonstrated that they can take guns and violent offenders off the street daily and still make the time to play ball or dance with neighborhood kids looking for mentors.”

The chief often talked about her role as a woman in law enforcement and her early private struggles, including successfully suing the department over sexual discrimination just five years into her career. Lanier said she hoped her success would inspire girls who might be struggling as she did, and she credited her rough youth with helping her gain acceptance of residents and many rank-and-file officers.

“There’s nothing that’s not possible with hard work,” she said at a news conference. “Your attitude, effort and hard work will get you where you want to go.” She said her legacy is changing the community’s perception of police. “Our community trusts us and believes in its officers,” she said.

D.C. Police Chief Cathy L. Lanier talks with members of the media after announcing her resignation during a news conference at D.C. police headquarters. (Jabin Botsford/The Washington Post)

Lanier used such outreach to navigate the perils of Washington politics, building a political base from the poorest of District neighborhoods to the John A. Wilson Building, where the council works. It helped her stave off disapproval, including criticism over a spike in homicides last year, which dinged her popularity.

Supporters say Lanier’s connection with the community helped the District avoid the turmoil that has embroiled American policing in the past few years, including in nearby Baltimore and most recently Milwaukee, where deaths in police custody and shootings by officers have led to unrest.

“She was willing to be part of the solution instead of slow-rolling or being obstructionist,” said Denise Rucker Krepp, a neighborhood activist from Hill East, where street robberies have been a problem. “She said, ‘Talk to me. I want to talk to you,’ ” Krepp said. “Her honesty and willingness to talk was refreshing. For me, she’ll be sorely missed.”

Violent crime dropped 23 percent over the years Lanier was chief, and homicides plunged to a half-century low in 2012. Though they spiked in 2015, one of the more difficult years for the chief, violent crime pales to when Lanier joined the force as a patrol officer and Washington was awash in killings and crack cocaine. She dealt with rioters in Mount Pleasant in her rookie year.

“My goal coming through the ranks was to rid this city of two things. Most importantly, the image of being the murder capital of the world and the image of being the city of unsolved homicides,” Lanier said. “That was the image of this police department, no matter where you went.”

Bowser said she will name an interim chief in coming days and then begin a search for a new leader of the 3,700-member department, which has shrunk in size over the past several years, even as the District continues to grow and gentrify. Lanier earned about $253,000 a year, and will receive an annual pension of at least $165,000 in addition to her NFL salary.

Lanier will replace Jeffrey Miller, the former state police commissioner of Pennsylvania who resigned from the NFL in the spring. He had been involved in controversy last year when it was reported he had received a video showing Baltimore Ravens running back Ray Rice striking his then-fiancée in an Atlantic City hotel elevator, though league officials said no one had viewed it before it became public.

Lanier said she was offered the new job on Friday and mulled it over during the weekend. She broke the news to the mayor on Monday. A half-dozen members of her command staff were at her side when she announced the news publicly, and she said she got 700 messages of support.

Other residents, though, have found fault in her crime-fighting efforts.

Eugene Puryear, an organizer with the D.C.-based Stop Police Terror Project, which is part of the region’s broader Black Lives Matter movement, called Lanier an “uncompromising defender of the type of militarized police actions and strategies that have come under intense scrutiny since the arising of the movement for black lives.”

The group was angry after Bowser, with the chief’s support, pressed last year for stricter criminal penalties.

In 2009, Lanier lost a crime battle with a federal judge who ruled her efforts to erect roadblocks around a bullet-riddled neighborhood called Trinidad were unconstitutional. In past years, residents also have spoken out against “jump outs,” in which officers searched young men on street corners — a practice Lanier eventually stopped.

Within the department, the chief has been criticized for disbanding drug squads, a move former union leaders said contributed to last summer’s jump in homicides.

The chief led the department through the September 2013 mass shooting at the Navy Yard, in which a gunman fatally shot 12 people and wounded three others before he was killed by police. Lanier was also a public voice during the 2014 disappearance of 8-year-old Relisha Rudd, who went missing from a D.C. homeless shelter and is presumed to have been killed by a janitor who worked there.

She has announced arrests in many high-profile crimes, including the killing of federal intern Chandra Levy and the slayings of four people in a Northwest D.C. home. But she also has appeared at countless crime scenes and vigils in the city’s more impoverished areas. “I remember each and every one,” she said of her conversations with countless grieving relatives.

Lanier’s tenure also saw significant changes in policing.

Police say they are seeing more high-powered weapons on the streets and that the use of synthetic drugs is contributing to crime. The D.C. force has begun using body cameras amid increased scrutiny of officers nationwide.

On the national stage, Lanier became a voice for gun-control laws, complaining that crime in the District and other cities was driven up by repeat violent offenders with easy access to weapons.

While she headed the department, possessing and privately using small amounts of marijuana became legal, the courts time and again forced the city to rewrite rules for gun ownership, turning the District into a battleground for Second Amendment cases and overturning the city’s long-standing firearms ban that upended one of the centerpieces of the chief’s crime-fighting strategy.

Ronald L. Moten, co-founder of the anti-violence youth group Peaceoholics, said Lanier’s leadership initially led to positive relationships with the community that helped reduce crime but that with time faded.

“When it becomes all about politics, you start looking at numbers, not looking at people.” Her successor, Moten said, should be “a culturally competent native person ready to deal with a more diverse city with the understanding they must do the right things for the right reason so that our city can get the right results.”

Former D.C. police chief Charles H. Ramsey said that any big-city police chief can only hope to make some progress to make streets safer and “leave the job better than you found it.”

“I am very proud of Cathy, she did an excellent job as police chief in Washington,” Ramsey said. “It’s a challenging job, but she did very, very well. The crime rate in D.C. remained relatively low. It was nothing next to what it was in the early ’90s.”

Scott Clement, Lynh Bui, Alice Crites, Mark Maske and Perry Stein contributed to this report.