Cyrus R. Vance Jr., the Manhattan district attorney, is expected to announce next week that his office will vacate misdemeanor marijuana warrants dating to 1978.

Even as the authorities in New York City have scaled back enforcement of marijuana laws, a legacy of tough policies remains: People are hindered from getting jobs, apartments and access to education because of decades-old marijuana convictions and outstanding warrants.

Now Cyrus R. Vance Jr., the Manhattan district attorney, is expected to announce next week that his office will vacate misdemeanor marijuana warrants dating to 1978. In Brooklyn, District Attorney Eric Gonzalez is going further, offering people with low-level convictions for marijuana possession the chance to have them vacated and the underlying charges dismissed.

Mr. Gonzalez’s office will also automatically vacate 3,438 open marijuana warrants stemming from summonses and is encouraging people to come forward to have misdemeanor arrest warrants cleared.

The moves are part of a national shift in how states and cities are rethinking marijuana laws. The drug has been legalized in nine states and Washington, D.C., and cities including San Francisco and San Diego are automatically clearing old misdemeanor convictions.

Both the Manhattan and Brooklyn district attorneys have stopped prosecuting the vast majority of people arrested on marijuana offenses, responding to enforcement policies that ended up targeting young black and Hispanic men.

“We must remember those who have convictions on their record based on these cases that we are no longer going to prosecute,” Mr. Gonzalez said during a news conference Friday announcing the changes. “To fail to address these past convictions would be hypocritical and would be to turn a blind eye on all the harm caused by marijuana enforcement in prior years.”

In Manhattan, where 3,042 misdemeanor marijuana warrants will be vacated, 78 percent of the defendants in those cases are black and Hispanic.

“The effect of an open warrant can be very negative,” Mr. Vance said during an interview at his office this week. “It can prevent you from getting a job. It can prevent you from going to the police to report other crimes for fear that you’re going to be picked up. If you are an immigrant, you also run the risk of deportation.

“When folks say this is crazy and New York City is going to hell in a handbasket, we are not. The city wants a rational approach to criminal justice.”

Mr. Vance said he would also like to clear certain marijuana convictions, but that would require state legislation that would allow for record expungement. Mr. Gonzalez is circumventing the legislation issue by instead vacating convictions and dismissing charges. In Brooklyn, at least 20,000 people have a low-level marijuana conviction dating to 1990.

People with certain violent felonies or sex offenses are not eligible to have their convictions vacated in Brooklyn.

Defense attorneys, elected officials and academics lauded the new initiatives, calling them “a step in the right direction.”

“The recognition is that this has to stop,” said Justine Luongo, the chief of Legal Aid’s criminal defense practice. “Marijuana is not an issue that should be criminalized.”

Lisa Schreibersdorf, executive director of Brooklyn Defender Services, called Mr. Gonzalez’s decision to vacate convictions “a visionary one.”

“It will save so many of our clients from deportation, loss of student loans, loss of housing, removal of their children and other very disproportionate outcomes that make no sense,” Ms. Schreibersdorf said. “Of course, New York should legalize marijuana, but in the meantime this is an incredible opportunity for Brooklyn residents.”

In the spring, the Brooklyn district attorney’s office began declining to prosecute some cases of people who were arrested on charges of smoking marijuana in public. In Manhattan, prosecutors spent six months studying cities that have legalized marijuana and released a report in May. The purpose, Mr. Vance said, was to review what other states were doing and seize on opportunities for improvement in New York.

“The impact on individuals and communities affected marks a significant shift in the understanding of prosecutors and the job they’re doing and how they should do it,” said David M. Kennedy, a professor at John Jay College of Criminal Justice in Manhattan. “It represents another really important step in a new trajectory that the city is on with respect to criminal justice and public safety.”

A New York Times investigation in May found that the primary targets of marijuana arrests in New York City are black and Hispanic people. In the past three years, black people were arrested on low-level marijuana charges at eight times the rate of white people, and Hispanic people were arrested at five times the rate of white people. In Manhattan, those figures were even more troubling: black people were arrested at 15 times the rate of white people.

The following month, Mayor Bill de Blasio announced that the Police Department would cut down on arrests for publicly smoking by more than half and give people summonses instead, but would continue to arrest some individuals who have past arrests or convictions. Gov. Andrew M. Cuomo announced last month that a working group will draft legislation proposing the legalization of marijuana.

When asked about the programs announced by the district attorneys in Brooklyn and Manhattan, Mr. de Blasio’s Office of Criminal Justice said it would review the initiatives.

It was unclear whether district attorneys in other boroughs are considering similar measures. In Staten Island, the district attorney’s office declined to comment. The Bronx district attorney, Darcel D. Clark, called for the State Legislature to decriminalize marijuana.

“Decriminalization would ensure fairness for residents of the Bronx and throughout New York State,” Ms. Clark said in a statement. “The piecemeal approach to enforcing marijuana laws county by county creates disparity and will not change the underlying fact that marijuana is still illegal.”

A spokeswoman for the Queens district attorney, Richard A. Brown, said the office would review any marijuana misdemeanor arrests that have not been dismissed. City Councilman Rory Lancman criticized Mr. Brown for not doing more.

“Every New York City resident has the right to ask their district attorney why they can’t have the same benefits as the policies in Brooklyn and Manhattan,” Mr. Lancman said, adding that in Queens the office has lagged behind in “recognizing how damaging many years of policing and prosecution have been to hundreds of thousands of residents over the years.”

A 36-year-old woman who asked to remain anonymous because she hopes to have her marijuana possession conviction dismissed said she has long dreamed of being a New York City taxi driver. She had held off applying for fear she would not get the job with a drug conviction in her past.

But after Mr. Gonzalez’s announcement, the woman, a mother of three, said she will begin to save money to pay the Taxi and Limousine Commission’s application fee. She hopes that her conviction will be vacated.

“I know I broke the law,” she said. “I became a public nuisance. I want to show the community that I changed.”