D.C. Council member Kenyan R. McDuffie, a Democrat who has represented Ward 5 since 2012, announced Thursday that he is relinquishing his seat and running for D.C. attorney general next year. McDuffie becomes the second candidate to enter the race to succeed Attorney General Karl A. Racine (D), who recently announced he is not seeking another term.

In an interview before his announcement, McDuffie said he wants to build upon the foundation Racine established as the city’s first elected attorney general, using his experience as a lawmaker and former prosecutor to defend low-wage workers and consumers, target unscrupulous businesses and protect the environment.

“The ability to fight for vulnerable residents is extraordinarily important to me,” said McDuffie, 46. “I have an intimate understanding of the District of Columbia and its people. I don’t think anybody else in this race will bring the broad, rich experience that I would bring to the position.”

McDuffie will probably be among the most recognizable candidates to succeed Racine, who made national headlines for filing litigation against former president Donald Trump and other major entities.

Ryan Jones, a sole practitioner lawyer from D.C., is the only other candidate to file paperwork for the attorney general’s race so far. Racine has not taken a public position on a successor except to say he hopes the city has a competitive pool of candidates to choose from.

McDuffie said he will participate in the city program that offers public financing to candidates who accept only small-dollar donations.

He joined the council after winning a 2012 special election to replace Harry Thomas Jr., who resigned after being charged with embezzling more than $350,000 in taxpayer dollars intended for youth programs.

In the wake of the scandal, McDuffie pledged to legislate with “ethical, honest leadership” while tending to the needs of all residents in the racially and economically diverse Ward 5, which contains much of Northeast Washington. He won reelection twice and has focused on issues such as racial equity and juvenile justice.

On Monday morning, McDuffie walked around the Stronghold neighborhood, waving to constituents outside the home where his family has lived for multiple generations. He recalled growing up in the mid-1980s as the city battled dual epidemics of crack cocaine and gun violence, adding that he recognizes what it means to live with economic stability and opportunity — privileges that he says every resident should enjoy.

If elected, McDuffie says he would protect the District and consumers from financial exploitation while ensuring tax dollars can be spent on programs that benefit the city’s neediest residents. (Because D.C. is not a state, adult felony prosecutions in the District are handled by the U.S. attorney’s office, while the attorney general prosecutes most juvenile cases and enforces city laws and regulations.)

Flanked Thursday morning by friends and family outside his home, McDuffie took questions from reporters on how he would approach major city issues like policing, gun violence and housing affordability — on all fronts, he pledged to hold bad actors accountable.

“If you are standing up and fighting for justice and fairness for people, then you can count me as a friend,” he said. “If you violate our laws, if you take advantage of the people in our city … you will be public enemy number one in my administration.”

McDuffie said he would also work on housing affordability, especially given the steep rise in home prices in the city.

“I’m going to fight using all the myriad tools that are in the tool kit to make sure that we protect housing affordability and make sure housing providers are not taking advantage of low-income tenants,” he said.

A graduate of the University of Maryland School of Law, McDuffie clerked for a judge in Prince George’s County, then served there as an assistant state’s attorney, prosecuting misdemeanor and felony cases. He later worked as a trial attorney with the U.S. Department of Justice in its civil rights division, investigating prisons, juvenile justice and health-care facilities to determine whether their conditions were constitutional.

On the council, McDuffie has frequently championed policies and proposals with a racial equity lens.

Earlier this year, he was among the most vocal legislators to publicly criticize the District’s vaccine rollout — which faltered early in the city’s poorest neighborhoods — asserting officials should have focused on more equitable distribution from the onset. In August, McDuffie tried unsuccessfully to freeze a council proposal to build a school bus terminal in the Brentwood community, where residents have long complained of industrial pollution, citing concerns about air quality.

As chair of the judiciary committee in 2016, McDuffie spearheaded legislation to reform the city’s juvenile justice system with age-appropriate sentencing and alternatives to prosecution. That same year, the council unanimously passed a separate bill written by McDuffie to promote public health approaches to crime prevention, after he battled with Mayor Muriel E. Bowser (D) over the best solution to address a spike in homicides. He has repeatedly expressed frustration that some of the bill’s provisions remain unimplemented.

More recent legislation shepherded by McDuffie established new racial equity offices under the mayor and D.C. Council.

On Tuesday, the council unanimously passed a proposal by McDuffie to create public trust-fund accounts for D.C. children born into low-income families, expected to launch next year.

McDuffie now chairs the council committee on business and economic development, where he oversees a variety of matters pertaining to local and small businesses. Over the years, he has proved to be one of the more fiscally moderate members of the increasingly liberal council and has voted against recent proposals to raise taxes on the wealthy.

He drew criticism in 2019, when he was among a narrow majority of the council that voted to award a no-bid contract to the firm Intralot to operate the city’s sports betting program. Months earlier, he had voted against the idea of averting the city’s usual competitive bidding process. Since then, revenue from the sports betting app has fallen drastically short of projections.

The Washington Post later published a story about a document that identified McDuffie’s cousin as the chief executive of a business that would receive $3 million in the gambling contract. McDuffie’s cousin said he was not involved with the business, and the company in question later said his name was included in error. McDuffie said at the time he had no knowledge of the alleged connection and that he cast his vote to award the contract with the best interests of D.C. and its residents in mind.

Three Democrats have filed paperwork to run for McDuffie’s Council seat: chairman of the Ward 5 Democrats Gordon-Andrew Fletcher, D.C. State Board of Education President Zachary Parker and Faith Gibson Hubbard, a former official in the Bowser administration who most recently worked in her Office of Community Affairs.