ALBANY - New York Attorney General Eric Schneiderman's abrupt resignation announcement Monday sparked a potential free-for-all in the state Legislature, which will ultimately pick his replacement.

Schneiderman, a Democrat who rose to national prominence for his many battles with President Donald Trump, announced he will resign at the close of business Tuesday after The New Yorker detailed allegations from four women who say the attorney general slapped, choked and otherwise degraded them.

More: N.Y. AG Eric Schneiderman, #MeToo champion accused of violence, resigns

Since Schneiderman resigned, New York law says state lawmakers will pick his successor.

How will that work? Here's what you need to know:

What happens now?

The Senate and Assembly, in a joint session, will pick someone to fill out the remainder of Schneiderman's four-year term, which runs through the end of the year.

It's all laid out in Section 41 of the state's Public Officers Law, according to Bennett Liebman, Albany Law School's government lawyer-in-residence.

The law reads, in part: "When a vacancy occurs or exists, other than by removal, in the office of comptroller or attorney-general ... the two houses thereof, by joint ballot, shall appoint a person to fill such actual or prospective vacancy."

It will be up to legislative leaders when to call the session.

Who will control the process?

The Democrat-led Assembly and Speaker Carl Heastie, D-Bronx.

There are 213 seats in the state Legislature, meaning Schneiderman's successor will need 107 votes from lawmakers.

There are 104 Assembly Democrats in the chamber, according to Mike Whyland, a spokesman for Heastie. That's by far the single-largest bloc of votes among the legislative conferences and almost a majority on its own.

In a meeting Tuesday morning, Assembly Democrats discussed the legal considerations and logistics of appointing a replacement but did not discuss any individual candidates, Heastie said.

"We didn't discuss candidates," Heastie said. "It was really around the Legislature's authority and the options of what can happen."

Has this happened before?

Yes. Several times.

When Comptroller Alan Hevesi resigned amid a corruption scandal in late 2006, it set off a chaotic process to replace him.

Lawmakers — led by Assembly Democrats — ultimately settled on then-Assemblyman Thomas DiNapoli to succeed Hevesi, a choice that angered then-Gov. Eliot Spitzer, who preferred several candidates with more financial experience.

DiNapoli, however, was popular among his legislative colleagues, who voted him in. And he's won two terms since then.

In 1993, the Legislature picked another Democratic assemblyman — Oliver Koppell — to replace Robert Abrams as attorney general after Abrams stepped down a year early.

Will there be an election?

Yes.

The state attorney general position is on the ballot every four years. That includes this November, when a full four-year term will be up for grabs.

Manny Alicandro, a Republican corporate attorney from Manhattan, announced his bid for the seat Monday, hours before Schneiderman's resignation.

More: These are the Republicans challenging New York's Democratic slate

But Republican leaders say others could soon hop into the race, particularly after Schneiderman's exit.

Democrats, meanwhile, now have an unexpected vacancy to fill on their statewide ticket, but they have an advantage since the Legislature will almost certainly pick a Democrat to temporarily succeed Schneiderman.

But being selected by lawmakers to fill out Schneiderman's term isn't a guarantee that a candidate will win in November.

In 1994, Koppell lost a Democratic primary for attorney general. A Republican — Dennis Vacco — ultimately won in November.

In the meantime

In the short term, Solicitor General Barbara Underwood will lead the Attorney General's Office on an acting basis until the Legislature makes its pick.

Underwood was first appointed to her position by then-Attorney General Andrew Cuomo in 2007.

In a statement Tuesday, Underwood said she is "honored to serve the people of New York."

"Our office has never been stronger, and this extraordinarily talented, dedicated, and tireless team of public servants will ensure that our work continues without interruption," she said.

It's possible the Legislature could pick Underwood to fill out the remainder of Schneiderman's term and let voters decide in November who the next attorney general will be.

Speaking to reporters Tuesday in Westchester, Cuomo said the office is in "fine hands" with Underwood in the short term, saying there is both a role for the Legislature and voters.

He noted that the Democratic convention is later this month for the party to pick its candidates for statewide offices, including attorney general. Then there will be the general election in November.

"You have the legislative, but then you have the electoral," Cuomo told reporters.

"And this is an important decision, and I think this is going to be a decision where New Yorkers should have an opinion. I would urge New Yorkers to carefully weigh these candidates, because this position makes a real difference."