EXCLUSIVE

Harvey Weinstein may have been fired illegally by The Weinstein Company, a company that wrote a contract that said Weinstein could get sued over and over for sexual harassment and as long as he shelled out money, that was good enough for the Company.

TMZ is privy to Weinstein's 2015 employment contract, which says if he gets sued for sexual harassment or any other "misconduct" that results in a settlement or judgment against TWC, all Weinstein has to do is pay what the company's out, along with a fine, and he's in the clear.

According to the contract, if Weinstein "treated someone improperly in violation of the company's Code of Conduct," he must reimburse TWC for settlements or judgments. Additionally, "You [Weinstein] will pay the company liquidated damages of $250,000 for the first such instance, $500,000 for the second such instance, $750,000 for the third such instance, and $1,000,000 for each additional instance."

The contract says as long as Weinstein pays, it constitutes a "cure" for the misconduct and no further action can be taken. Translation -- Weinstein could be sued over and over and as long as he wrote a check, he keeps his job.

The contract has specific language as to when the Board of Directors can fire Weinstein -- if he's indicted or convicted of a crime, but that doesn't apply here.

There's another provision ... he can be fired for "the perpetuation by you [Weinstein] of a material fraud against the company." The question ... where's the fraud? Lance Maerov, the board member who negotiated Weinstein's 2015 contract, said in an interview -- and we've confirmed -- the Board knew Weinstein had settled prior lawsuits brought by various women, but they "assumed" it was to cover up consensual affairs. The Board's assumption does not constitute fraud on Weinstein's part.

And here's the kicker. Even if Weinstein had committed fraud by not fully informing the Board of Directors, the contract says before he can be fired he has a right to mediation and if that doesn't work, he's entitled to arbitration. He got neither. He was summarily fired, and sources connected with Weinstein tell TMZ he was never given a specific reason.