Credit: J. Countess/Getty Images for SBA

The Weinstein Company’s board of directors confirmed Thursday evening that they have reached an agreement to sell the company’s assets to an investor group led by former Obama administration official Maria Contreras-Sweet and backed by billionaire Ron Burkle.

The deal, which seemed all but dead just days ago, means the studio will narrowly avoid bankruptcy after being rocked by a sexual misconduct scandal centered on co-founder Harvey Weinstein. (Weinstein has denied all allegations of non-consensual sex.)

“The deal provides a clear path for compensation for victims and protects the jobs of our employees,” the Weinstein Co. board 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.”

The announcement followed a statement earlier Thursday by Contreras-Sweet — who is best known for running the Small Business Administration under President Obama — indicating that the deal would be salvaged and her new company would be “led by a board of directors made up of a majority of independent women.”

Contreras-Sweet launched the bid in November, but a potential deal was imperiled earlier this month when New York Attorney General Eric Schneiderman filed a lawsuit against the Weinstein Co., Harvey Weinstein, and brother Bob Weinstein and stressed that any sale “must ensure that victims will be compensated, employees will be protected going forward, and that neither perpetrators nor enablers will be unjustly enriched.”

In a statement Thursday night, Schneiderman said his office would “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.”