When Letitia “Tish” James was first sworn as New York City’s public advocate in January 2014, she scandalized the city’s political and media elites by ― the horror! ― daring to criticize outgoing Mayor Michael Bloomberg in her speech.

Standing alongside Dasani Coates, a young homeless girl whose hardships had recently been chronicled by The New York Times, James decried the city’s “decrepit homeless shelters” in the “shadow of gleaming multimillion-dollar condos.” Bloomberg, who was in attendance, survived the encounter with public criticism; he headed off to a two-week vacation in Hawaii and New Zealand shortly thereafter.

James ignored the pearl clutching and over more than four years in office ― she was re-elected in 2017 ― turned the public advocate’s office into a fearsome bulldog for New York’s most vulnerable residents. An April 2017 profile of James on New York news outlet City & State credits her with giving the office “some teeth.”

As of August 2015, with less than two years on the job, she had filed more lawsuits than her three predecessors combined had managed over the course of 20 years, according to The New York Times. Most of the suits were against city agencies for failing in their duties to low-income residents: against the NYC Finance Department for raising the rent on a 93-year-old widow living in subsidized housing, for example, and the NYC Education Department for failing to open school leadership meetings to the public. She also fought the city to provide air-conditioning on school buses and better heating for low-income public housing tenants.

James’ immediate predecessor and political ally, Mayor Bill de Blasio, had upped the budget for the advocate’s office. She used those resources to target the mayor’s government.

On Thursday, James won her biggest fight yet, defeating three primary-election opponents ― U.S. Rep. Sean Patrick Maloney, law professor Zephyr Teachout and Leecia Eve, formerly a lawyer in Gov. Andrew Cuomo’s administration ― for the Democratic nomination for New York state attorney general. Assuming James wins in November ― and like Cuomo, she is heavily favored ― she will be the first black woman to hold a major statewide office in New York.

But a funny thing happened to James on the way to her primary win: Her onetime backers on the left started to view her with suspicion.

James won her first public office, a seat representing central Brooklyn on the New York City Council, in a 2003 special election, in which she ran exclusively as a Working Families Party candidate. With the party-cum-progressive pressure group’s help, she defeated the Democratic Party’s chosen candidate, the brother of a slain councilman whose murder opened up the seat.

When she decided to run for attorney general, however, she sought the blessing of Gov. Cuomo, a sworn enemy of the WFP. James had a history of difficulty in raising money and Cuomo’s access to big donors looked essential.

In the process, James appeared to tone down her left-wing rhetoric, staking a middle ground between Teachout, a fierce Wall Street critic, and Maloney, Wall Street’s favored candidate.

“It’s really critically important that I not be known as the ‘Sheriff on Wall Street,’” James told The New York Times in August. She later clarified that she meant she would not focus on the financial industry to the exclusion of other targets.

Cuomo also forced James not to seek the WFP’s endorsement as a condition of his support for her. The WFP, which was already taking on the governor and eight renegade state Senate Democrats in the primaries, nonetheless decided to offer its ballot line to both James and Teachout.

The organization, which is a pillar of New York’s activist left, ended up spending $250,000 in ads blasting Maloney, who had voted to water down the Dodd-Frank Wall Street reform law. On Thursday night, Bill Lipton, the WFP’s New York state director, characterized Maloney’s loss as a major win for the organization and the left more broadly.

“A bad night would have been not just Andrew Cuomo winning but Sean Patrick Maloney, who was leading in the polls early on, winning as well,” Lipton told HuffPost. He maintained that James’ decision to distance herself from the WFP said more about Cuomo than it did about her.

“Tish James is going to be the strong, progressive attorney general we need to stand up to Donald Trump,” Lipton told The New York Times.

For New York’s next top law enforcement official, taking on President Donald Trump would not be merely a matter of pugilistic rhetoric. The state attorney general has broad power to investigate any company in New York. The president’s parent company, the Trump Organization, is located in midtown Manhattan.

Former Attorney General Eric Schneiderman successfully sued Trump for the fraudulent practices of Trump University, another New York-based company. And interim Attorney General Barbara Underwood, who took over after a sexual abuse scandal forced Schneiderman’s resignation, announced a lawsuit seeking damages against the Donald J. Trump Foundation in June.

At her victory party in Crown Heights, a diverse neighborhood in Brooklyn, James vowed to use the attorney general’s office to stand up to Trump ― and promised she’d remain the same scrappy fighter progressives had come to know and love.

“Nothing’s going to change about Tish,” she said Thursday night. “I’m still just a girl from Brooklyn.”

Even if James turns out to be a tougher foe for Trump than for the other real estate and Wall Street titans who call the shots in New York, her place as the establishment candidate on Cuomo’s slate reflects a major leftward shift in the American political landscape in the last several years. When James won the city’s public advocate post in 2013, no one would have imagined that the state’s establishment Democrats would be so frightened by an emboldened left that they would embrace a woman who had become a thorn in their side simply in hopes of avoiding the stronger sting of a reformer like Teachout.

Susan Kang, an associate professor of political science at John Jay College and leader of the New York City chapter of the Democratic Socialists of America, remains deeply skeptical of James, arguing that her alliance with Cuomo amounted to “switching sides.”

“In New York state politics, your bedfellows and your allies matter more than your ideology,” Kang said.

James also reportedly recorded a last-minute robocall on behalf of state Sen. Jose Peralta, a member of the now-dissolved Independent Democratic Conference, which had aligned with Republicans for years to stymie progressive reforms in the state legislature. (Peralta nonetheless lost to progressive challenger Jessica Ramos.)

Still, even Kang acknowledged that the attorney general race spoke to a historic moment of strength for the left. In a previous election cycle, progressive activists would have flocked to James despite the Cuomo endorsement because of their shared history, but this time they mostly rallied behind Teachout, Kang noted.

“The left has learned things,” she said. “We are communicating and we are connected to each other.”