The TWC board confirmed the agreement — which has also won the approval of the New York Attorney General — on Thursday evening.

After a tumultuous process, Maria Contreras-Sweet on Thursday afternoon announced that a deal has finally been reached for the investor group she and billionaire Ron Burkle lead to buy disgraced mogul Harvey Weinstein's former company after a sit-down between all sides with New York State Attorney General Eric Schneiderman earlier in the day. Several hours later, the board of The Weinstein Co. confirmed the news.

The sale, which rescues TWC from having to declare bankruptcy, is expected to take 40 days to close, presuming there aren't any obstacles.

Schneiderman also gave the deal his blessing after serving as an official mediator of sorts, saying in a statement, "As part of these negotiations, we are pleased to have received express commitments from the parties that the new company will create a real, well-funded victims' compensation fund, implement HR policies that will protect all employees, and will not unjustly reward bad actors. We will work with the parties in the weeks ahead to ensure that the parties honor and memorialize these commitments prior to closing."

Contreras-Sweet, a former Obama administration official, and Burkle organized the group of investors who are putting up $500 million to buy the once-powerful indie film and television production company founded by Weinstein and his brother, Bob, in 2005. Contreras-Sweet has said her involvement was inspired by the #MeToo movement and that she intends to install a female-majority board. Burkle, a longtime business and personal associate of Weinstein's, would be a minority stakeholder via his Yucaipa Companies.

According to sources, the buyers have agreed to establish a victims' fund amounting to $80 million-$90 million, as much as two times higher than the fund they originally planned to put in place. Also, there appear to be no plans now for Contreras-Sweet and Burkle to retain David Glasser as CEO of the new company. Glasser, who served for years as TWC's COO and Harvey Weinstein's No. 2, was fired for cause on Feb. 16 (he responded by threatening an $85 million lawsuit against the company, alleging he has been made a scapegoat).

"We are pleased to announce that we have entered into an agreement to sell the assets of The Weinstein Company to an investor group led by Maria Contreras-Sweet and Ron Burkle. The deal provides a clear path for compensation for victims and protects the jobs of our employees," TWC said in a statement. "We greatly appreciate the efforts of Attorney General Schneiderman and his staff, Maria Contreras-Sweet, Ron Burkle and his team at Yucaipa for bringing about this agreement. We consider this to be a positive outcome under what have been incredibly difficult circumstances."

Schneiderman has played a pivotal role in the sale process since filing a sweeping civil rights lawsuit last month against TWC and the Weinstein brothers, alleging that numerous employees were ignored when making HR complaints. His office has been adamant that the new venture include a sizable victims' fund and proper human resources protocols. He also doesn't want those who were complicit in ignoring proper HR practices to be rewarded.

The AG could now settle parts of the suit against the company and Bob Weinstein, although Schneiderman was careful to note in Thursday's statement that the suit remains active and that an investigation is ongoing.

TWC has never been able to recover from the multiple allegations of sexual harassment and assault lodged against Harvey Weinstein since last October, despite the fact that he was quickly fired from the company he co-founded.

"Our team is pleased to announce that we have taken an important step and have reached an agreement to purchase assets from The Weinstein Company in order to launch a new company, with a new board and a new vision that embodies the principles that we have stood by since we began this process last fall. Those principles have never wavered and have always been to build a movie studio led by a board of directors made up of a majority of independent women, save about 150 jobs, protect the small businesses who are owed money and create a victims’ compensation fund that would supplement existing insurance coverage for those who have been harmed," Contreras-Sweet said in her statement.

Her comments followed a lengthy meeting at the AG's office where the buyers and sellers resolved their remaining differences following numerous stops-and-starts in the dealmaking process, including the AG's lawsuit. Those in attendance included Contreras-Sweet, Burkle, Bob Weinstein, Schneiderman and TWC board member Lance Maerov, according to sources.

At the time Contreras-Sweet issued her statement, a fleet of lawyers for both sides were still hammering out the final details.

Last week, Schneiderman's chief concerns were allayed when the buyers and sellers agreed to certain provisions, but on Sunday night, any deal appeared derailed when the TWC board fired off a missive to Contreras-Sweet and Burkle saying it was terminating talks and preparing for bankruptcy. A chief point of contention was interim funding needed to keep the company afloat during the process, which could take 30 to 40 days, according to insiders.

The buyers will assume $225 million in debt.

Contreras-Sweet has already staked out office space in Hollywood that was formerly the home of Broad Green Pictures. It isn't yet clear who will run the day-to-day operations.

Once any deal is done, Bob Weinstein will leave and start his own venture, Watch This, taking certain titles from the Dimension label.

Contreras-Sweet's full statement:

Our team is pleased to announce that we have taken an important step and have reached an agreement to purchase assets from The Weinstein Company in order to launch a new company, with a new board and a new vision that embodies the principles that we have stood by since we began this process last fall. Those principles have never wavered and have always been to build a movie studio led by a board of directors made up of a majority of independent women, save about 150 jobs, protect the small businesses who are owed money and create a victims’ compensation fund that would supplement existing insurance coverage for those who have been harmed. The cornerstone of our plan has been to launch a new company that represents the best practices in corporate governance and transparency.

This next step represents the best possible pathway to support victims and protect employees.

We are grateful to the New York State Attorney General’s office for their efforts in helping us reach an agreement and we are grateful to our investors who have believed in this process and in the compelling value of a female-led company. We also want to thank all the parties who returned to the negotiating table to help us reach this development.

I have had a long-standing commitment to fostering women ownership in business. This potential deal is an important step to that end.

The TWC board's statement:

We are pleased to announce that we have entered into an agreement to sell the assets of The Weinstein Company to an investor group led by Maria Contreras-Sweet and Ron Burkle. The deal provides a clear path for compensation for victims and protects the jobs of our employees. We greatly appreciate the efforts of Attorney General Schneiderman and his staff, Maria Contreras-Sweet, Ron Burkle and his team at Yucaipa for bringing about this agreement. We consider this to be a positive outcome under what have been incredibly difficult circumstances.

New York Attorney General Eric T. Schneiderman's statement:

As I made clear from the start, our office will support a deal that ensures victims will be adequately compensated, employees will be protected moving forward, and those who were responsible for misconduct at TWC will not be unjustly rewarded.

As part of these negotiations, we are pleased to have received express commitments from the parties that the new company will create a real, well-funded victims compensation fund, implement HR policies that will protect all employees, and will not unjustly reward bad actors. We will work with the parties in the weeks ahead to ensure that the parties honor and memorialize these commitments prior to closing. Our lawsuit remains active and investigation remains ongoing at this time.