Letitia James, the New York City public advocate, announced her candidacy for New York State attorney general on Wednesday, seeking the Democratic nomination in November.CreditCreditHiroko Masuike/The New York Times

Letitia James, the New York City public advocate, declared her candidacy for the Democratic nomination for attorney general on Wednesday, ending a week filled with rumors and political machinations about whether she would be appointed to the office or run for it, and with which party’s backing.

After the sudden resignation of Eric T. Schneiderman last week, Ms. James’s name immediately surfaced as a candidate to replace him, first as an interim appointment by the state Legislature.

But as newspaper editorial boards urged lawmakers to keep the interim attorney general, Barbara Underwood, who had served for years as state solicitor general, in the job, Ms. James withdrew her name from consideration to fill out the last seven or so months of Mr. Schneiderman’s term.

Instead, Ms. James said she wanted to place her candidacy before voters, saying that she would defend vulnerable communities and take on everything from corruption to crooked businesses, as well as the administration of President Trump.

“New Yorkers deserve an attorney general who is unwavering in her fight to uphold and defend their most basic rights,” Ms. James said in a brief speech at the Brooklyn Historical Society, where she was surrounded by cheering supporters holding signs calling her “the people’s lawyer.”

If elected, Ms. James, the first black woman in New York City to hold citywide elected office, would make history again by becoming the first black woman to win statewide elected office, a point that was echoed by supporters and former colleagues as especially significant in the era of #MeToo and the difficult racial dynamics playing out in the country.

“It’s incredibly exciting for women of color to see her take this historic step,” said Juanita Scarlett, a political consultant who worked with Ms. James when she was an assistant attorney general running the Brooklyn regional office. “Tish James embodies the vision of the attorney general’s office to be the largest public interest law firm.”

But Ms. James’s decision was not without political intrigue. She announced on Wednesday that she would not seek the Working Families Party’s line for the ballot, even though Ms. James won her first elected office with that party’s backing. Multiple people close to Ms. James said that she told them the political operation of Gov. Andrew M. Cuomo was pushing her to turn down the Working Families nomination, or risk losing his support should she win the Democratic nomination.

Mr. Cuomo, who denied pressuring Ms. James, has been locked into a battle with the Working Families Party since it endorsed his Democratic primary opponent, Cynthia Nixon, last month. Having a black woman on his ticket would help Mr. Cuomo engage his black base of supporters, which Ms. Nixon has furiously courted as an important path to victory.

Four leaders of the Working Families Party released a statement accusing Mr. Cuomo of demanding that Ms. James “jump through hoops that he would never ask a white man to do,” saying that the party’s support “could be critical in both the primary and general elections.”

Bill Lipton, the state director of the Working Families Party, went further, saying that Mr. Cuomo “cares more about hurting the W.F.P. than Tish James’s success.”

Lis Smith, a spokeswoman for Mr. Cuomo’s campaign, said it was “the height of sexism” to imply that “Tish James cannot make her own decisions.”

After her speech, Ms. James dodged questions about her decision to turn her back on the Working Families Party.

“I am focusing on securing the Democratic nomination,” Ms. James said after her speech.

Ms. James said that echoes of her run for attorney general can be found in her political and legal career. A graduate of Howard University School of Law, she served as a public defender for the Legal Aid Society because indigent individuals should not be “denied basic rights.”

As an assistant attorney general in Brooklyn, James focused on issues such as predatory lending and stop-and-frisk tactics. Multiple former colleagues said she was key in reaching out to members of the community, overcoming their skepticism about law enforcement and convincing them to work with the attorney general’s office on those cases.

“She was a hard-working, substantive lawyer with deep roots in the community,” said Andrew G. Celli Jr., a founding partner at Emery Celli Brinckerhoff & Abady who served as the chief of the civil rights bureau from 1999 to 2003 under the former attorney general, Eliot Spitzer. “She cared about getting it right and she cared about the people we served.”

Ms. James also served as a counsel to the State Assembly and also as a Brooklyn councilwoman.

Now in her second term as the public advocate, Ms. James has used the office to take on neglectful landlords and the city. She filed several lawsuits against the city, including ones challenging the treatment of children in foster care by the Administration for Children’s Services, and the Department of Education for not providing adequate air conditioning for mentally disabled children on its buses during the summer.

“The law is our most effective tool for justice,” Ms. James said.

Ms. James’s office, however, was ultimately removed from several lawsuits because it was determined that the public advocate did not have the standing to file or join the lawsuit.

Ms. James, who often presides over Council meetings seated in a red and white upholstered chair marked with a giant star, has also used the public advocate’s office to introduce 48 pieces of legislation, 10 of which are now law. One of Ms. James’s signature pieces of legislation is a bill that prevents employers from asking job applicants their previous salary. The practice often keeps women from earning as much as men, Ms. James said.

Before Mr. Schneiderman’s resignation, Ms. James’s political future was squarely focused on running for mayor in 2021.

She was often mentioned as a leading early mayoral candidate, along with other city officials such as the comptroller, Scott M. Stringer, the Brooklyn borough president, Eric L. Adams, and the Bronx borough president, Ruben Diaz Jr.

Ms. James’s interest in becoming attorney general is not her first flirtation with a public office other than the one she currently holds. After the death of Kenneth P. Thompson, the first black district attorney of Brooklyn, Ms. James saw her name floated as an interim replacement. Although she eventually pulled out of contention, she drew criticism for her display of ambition — something that Ms. James’s supporters said that a male candidate would not have received.

Ms. James betrayed no concerns during her announcement, where she displayed both swagger and humor. But she has never run a statewide campaign, and that promises to be very different than her two citywide efforts.

“It would be tough to beat her in a primary, but she still has to win a general election,” said the former Assembly speaker, Mel Miller, who nonetheless said he would bet on Ms. James winning.

Ms. James on Wednesday showed some signs of perhaps being on a learning curve regarding points north and west of the city, when she said during her speech that she was looking forward to meeting farmers while campaigning. Afterward, as she headed for the exit, Ms. James was asked to name her favorite upstate town.

A version of this article appears in print on , on Page A21 of the New York edition with the headline: New York City Public Advocate Enters Attorney General Race. Order Reprints | Today’s Paper | Subscribe