If Commissioner Keechant Sewell, head of the nation’s largest police force, wanted to promote an investigator to first-grade detective, she had to clear it with City Hall, according to her former top uniformed officer.

When she was selecting someone to run the New York Police Department’s Intelligence Division, her choice was blocked by members of Mayor Eric Adams’s administration, according to several current and former officials.

And when First Deputy Commissioner Edward Caban and Chief of Department Jeffrey Maddrey took the department’s second- and third-highest jobs, they had been handpicked not by Ms. Sewell but by Mr. Adams, those officials said.

After less than 18 months on the job, Ms. Sewell had apparently had enough. She will leave 1 Police Plaza for good at the end of the month.

Ms. Sewell, 51, is walking away from a department of 36,000 uniformed officers that saw the rate of major crimes like murders and shootings fall during her tenure. Morale, at critical levels following the pandemic and racial-justice protests in 2020, was slowly improving, partly because of a contract she helped negotiate that included raises and more flexible schedules. She added about 30 detectives to a sex-crimes unit that for years had been understaffed and overworked.

Now, officers, department watchdogs and community leaders are trying to figure out what comes next.

Mr. Caban, who has been with the department since 1991, is the leading candidate to become interim commissioner, according to several officials with knowledge of the decision.

Whoever heads the department will face a slew of challenges: officers who union leaders say are being lured away by better hours and pay; residents of color who do not trust the top leaders; and the challenge of keeping the city safe enough to foster a post-pandemic revival.

Perhaps the most daunting task will be serving a mayor — himself a former police captain — whose administration is believed to have meddled so much that Ms. Sewell felt she had to quit. While previous commissioners said they had to deal with some level of micromanagement, they said they were typically allowed to pick their own teams and rarely had to get approval for discretionary promotions.

Patrick Hendry, the incoming president of the Police Benevolent Association union, said officers saw Ms. Sewell as “someone who truly cared.”

“We didn’t think she was going anywhere,” he said, adding, “No matter who the police commissioner is going forward, whether it is Commissioner Caban or someone else, we have real issues that we have to address right away.”

Signs of a new chapter emerged soon after Ms. Sewell’s announcement on Monday.

On Tuesday, Mr. Adams canceled his appearance at a Pride event at headquarters, where he and Ms. Sewell had both been scheduled to speak. Ms. Sewell did not take the stage. Instead, she remained seated in the back as a line of high-ranking command staff sat in the front row, including Mr. Caban. On Thursday, Mr. Caban joined Mr. Adams at an appearance related to World Elder Abuse Awareness Day that Ms. Sewell had been scheduled to attend.

A spokesman for Mr. Adams declined to comment, referring to a news conference where Mr. Adams defended his management and said he was the only mayor in decades “who actually worked in a city agency.”

“Every other mayor had to turn over those agencies and allow people to run them the way they desire,” Mr. Adams said. “That’s not how I function.”

Ms. Sewell did not respond to a message seeking comment. On Thursday, the department’s Twitter account posted a video of her at Gracie Mansion for a Juneteenth celebration, where she thanked Mr. Adams for making her the commissioner and called it “the honor of my lifetime.”

But in December, Ms. Sewell gave a fiery speech at a scholarship ceremony hosted by the Policewomen’s Endowment Association that was cast as a rhetorical letter to whomever might become the department’s second female commissioner. Ms. Sewell warned that person that she would be “second-guessed, told what you should say, told what you should write by some with half your experience.”

“You will get free unsolicited personal advice: ‘Your hairstyle is wrong, you look tired, already worn out in less than a year, you should wear different clothes, you’re not qualified, you are in over your head,” she said to applause and cheers. “None of this is true.”

William J. Bratton, the department’s former commissioner, called Ms. Sewell’s departure a “lesson for the mayor.”

Mr. Adams should reflect on “what the hell went wrong,” he said, adding, “How do you lose somebody as talented and respected and capable as her?”

Advocates for survivors of sexual assault said they hoped that the next commissioner would continue the momentum they saw building under Ms. Sewell. She had put in a new chief to run the Special Victims Division, told him to prioritize the concerns of advocates, provided more training for officers on how to interact with victims and installed a legal adviser to help investigators understand laws and procedure, they said.

“It was great that Mayor Adams appointed the first woman commissioner, but it was so much more important that he chose a commissioner who took crimes against women seriously,” said Jane Manning, the director of the Women’s Equal Justice Project.

Ms. Sewell also earned a reputation for loyalty to her subordinates that angered some watchdogs.

The Civilian Complaint Review Board, a watchdog agency that examines police misconduct, said that in 2022 she rejected more than half of its disciplinary recommendations. Ms. Sewell defended her record, saying that in many of those cases, the board had not given the department enough time to review complaints. When it did, she said, she agreed with the board’s recommendations more than 80 percent of the time.

Arva Rice, the chairwoman of the board, said that the relationship improved after the department agreed to provide the data to investigate complaints of racial profiling. She said she hoped the new commissioner would be pushed to cooperate more.

“The mayor said he’s in support of accountability,” Ms. Rice said. “We want to make sure we’re in line with him on what that means, and what those polices look like in action.”

Donna Lieberman, the executive director of the New York Civil Liberties Union, said her organization was troubled by what she sees as a sharp return under Mr. Adams to more aggressive tactics that disproportionately affect Black and Latino residents. “It’s no stretch to say he’s been serving as police commissioner in many ways,” she said.

She noted that the number of times police stopped and frisked people on the street, while still far lower than a decade ago, increased in the past year.

Police issued more than twice as many summonses in the first quarter of 2023 compared with the same period in 2022 for low-level offenses like open container violations, disorderly conduct and public urination, according to the organization’s analysis.

“Things are not going in the right direction,” Ms. Lieberman said.

Many young officers, who were horrified by images of police brutality they saw in the city and across the country, want a different approach, said Edwin Raymond, who retired as a lieutenant last month and has criticized the department for discriminating against Black and Latino residents.

“There is a disconnect between the powers that be and the rank and file,” he said. Mr. Raymond said he believed Ms. Sewell appeared ready to enact more reforms, but “she didn’t have enough time.”

Kenneth Corey, the former chief of the department, who was briefed on how Ms. Sewell’s promotions were vetted by the Adams administration, said that she had connected more quickly with the rank and file than any other commissioner he had seen.

She moved officers to tears with her eulogies for Jason Rivera and Wilbert Mora, who were fatally shot less than three weeks into her tenure. On Christmas Eve, she visited nearly two dozen precincts and dropped off Italian cookies for officers working the holiday shift. She visited the home of an officer whose teenage daughter had contracted a staph infection and had to have limbs amputated.

Mr. Corey recalled an event for fallen officers, where Ms. Sewell abruptly stopped reading from prepared remarks and looked out at the families in front of her.

“‘Yeah, I don’t want to do this,’” Mr. Corey recalled her saying. “‘What I’m going to do is walk around and talk to you.’”

She spent the next two hours going from table to table, asking about the officers who had died, Mr. Corey said.

At the Pride event on Tuesday, Ms. Sewell waited until the ceremony was over, then strode to the front of the auditorium to meet with officers, who quickly lined up for pictures and hugs. One who took a photo with her ran to a group of friends and beamed as she showed it to them.

The officer said she had wanted to get one last shot with the commissioner before she left.

Hurubie Meko, Emma G. Fitzsimmons and William K. Rashbaum contributed reporting.