New York City Public Advocate Letitia James has secured the Democratic nomination to become the state's next attorney general.

The Associated Press called the race for James at 10:30 Thursday night, and she made a victory speech after 11 p.m.

If she wins the general election in November, James will become the first woman to be elected to the position, the first person of color to serve as the state's top attorney and the first woman of color elected to statewide office. In addition, she would secure an office with the ability to oppose Trump administration policies and is investigating the Trump Foundation.

Addressing supporters Thursday night, James called out “the man in the White House” and highlighted her opposition to President Donald Trump.

James will now compete against Keith Wofford, the Republican nominee, for the next eight weeks until the general election on Nov. 6. The position has been held by a Democrat since 1999 after the election of former Gov. Eliot Spitzer, who served as attorney general until he became governor in 2007.

“The next two months will be just as important as the last three, because we now face an opponent who voted for Donald Trump, who doesn't share our values,” James said to supporters Thursday night. “Now is not the time for a Trump supporter to be in the office of attorney general.”

James was the endorsed candidate of the State Democratic Committee, which picked her for the spot in May. The party scrambled to coalesce around a nominee after former Attorney General Eric Schneiderman resigned just weeks prior amid allegations of domestic abuse.

James secured the party's favor over Leecia Eve, a lobbyist for Verizon and former economic development official in the Cuomo administration and Fordham Law professor Zephyr Teachout. Rep. Sean Patrick Maloney, D-New York, announced his campaign after the state party's convention.

James won with 40.6 percent of the vote to Teachout's 31 percent. Maloney took 25 percent of the primary vote.

In a tweet just before midnight, Teachout said “Congratulations to Tish James on her historic victory. I'm proud of the race we ran and so grateful for every vote.”

James was the preferred candidate of Gov. Andrew Cuomo, who endorsed her before the party convention in May. But has said publicly that she will remain independent from Cuomo, if elected in November.

If she is elected attorney general, James would be in a sense returning to the office.  James previously worked in the Brooklyn Regional Office of the New York State Office of Attorney General before her election to the New York City Council. She started her career as a public defender with the Legal Aid Society.

She was elected to the position of New York City Public Advocate in 2013, the same year Bill de Blasio was elected the city's mayor. She was re-elected to the position last year by a large margin.

James was widely rumored to seek the interim position of attorney general that was created when Schneiderman resigned, but she declined to seek the spot in favor of a run for the office. Barbara Underwood, formerly the state's solicitor general, was ultimately chosen by the Legislature to serve out the remainder of Schneiderman's term.

James is set to compete against Wofford for the office in November, but she's already been running against another Republican—Trump—since she launched her campaign in May.

She mentioned Trump at several times during her victory speech in Brooklyn Thursday night.

“This campaign was never really about me or any of the candidates who ran,” James said. “It was about the people, but most importantly it was about that man in the White House who can't go a day without threatening our fundamental rights, can't go a day without threatening the rights of immigrants, can't go a day without dividing us.”

James, like the other Democrats who sought the position, has pledged to continue the work of Underwood in pursuing litigation against the Trump administration and possibly Trump himself.

The incoming state attorney general will inherit Underwood's lawsuit against the Trump Foundation, which includes claims against Trump, himself and his children. She is seeking an expedited dissolution of the foundation and restitution for a fundraiser the foundation allegedly arranged in collaboration with officials from Trump's 2016 campaign.

They also could inherit a possible criminal prosecution of Trump and those in his inner circle. The state Department of Taxation and Finance has an ongoing criminal investigation into Trump that could be referred to the state attorney general for prosecution.

The next attorney general also may have jurisdiction to bring state charges against those close to the president, if they are charged with a federal crime and subsequently pardoned, but that depends on the Legislature. Democrats have introduced a bill that would allow prosecutors in New York to bring state charges on the same set of facts, if there's a pardon or acquittal at the federal level. That's currently not allowed in New York.

James supports the bill, which would close the so-called double jeopardy loophole.

She also wants more power to investigate and prosecute public corruption in state government. She said during a debate earlier this month that she's already spoken to Assembly Speaker Carl Heastie and members of the state Senate about granting more power to the state attorney general to tackle public corruption, which remains persistent in New York.

The attorney general currently has to receive a criminal referral from an appropriate state agency to pursue criminal charges against an elected official on claims of public corruption. She wants the office to be able to independently investigate and prosecute those cases without such limits.

That position was not unique for James in the race. Each of her opponents also wanted to expand the attorney general's power to tackle public corruption. Teachout, in particular, made it a sticking point of her campaign, not to mention her career.

Wofford also has made public corruption a top priority for his campaign but plans to focus as well on how the office of attorney general can improve the state's economy. He said last month that none of the Democrats vying for the position have explained how they would help create jobs, particularly in upstate New York.

He made his first statement of the general election following James' victory Thursday night, focusing on her ties to elected Democrats and labeling himself as an outsider.

“I'm the only candidate in the race for New York state attorney general that has the qualifications and independence to give voters exactly what they want and deserve,” Wofford said. “Unlike my opponent, I've spent the last two decades in the private sector practicing law at the highest level. I'm an independent political outsider who knows how to get results, and I'm ready to put my legal skills to work for the people of New York state.”

READ MORE:

Candidates for AG Want More Power to Tackle Corruption, Differ on ICE at Democratic Forum

Which Cases Were NY AG Democratic Hopefuls Proudest to Litigate? Read Their Answers

Testy NY AG Debate Focuses on Dem Candidates' Financial Dealings