SAC Capital Advisors, once among the world’s most successful hedge funds, has agreed to close its doors to outside investors and pay a record-setting $1.8 billion to settle charges that it engaged in inside trading as far back as 1999.

In a deal with the feds announced Monday, billionaire owner Steve Cohen’s SAC also agreed to to hire a government-approved “independent compliance consultant” to monitor its trading activity as it winds down its funds through a probation period.

In a letter to two judges overseeing separate criminal and civil cases against SAC, prosecutors called terms of the unprecedented deal “steep but fair,” saying the penalties “are commensurate with the breadth and duration of the criminal conduct.”

At an afternoon news conference, Manhattan U.S. Attorney Preet Bharara said, “what has happened today is a very substantial thing,” adding that SAC was paying “the just and appropriate price, in our view, for the conduct that occurred here.”

Bharara noted that “SAC has made it clear that no outside money will be used to pay for the penalties.”

Bharara also emphasized that the deal didn’t close the door on potential prosecution of Cohen, who is alleged in court papers to have “enabled and promoted” his firm’s crooked practices.

“With respect to individuals either at this hedge fund or the countless others…we will continue to pursue insider trading,” he said.

FBI Special Agent-in-Charge April Brooks said SAC’s admissions illustrate how the firm “institutionalized their practices by cultivating a culture of corporate corruption.”

Brooks also warned investment titans against the “greed is good” ethos popularized in the famed 1987 movie “Wall Street.”

“To those on the street who venerate Michael Douglas’ character Gordon Gekko, understand this: principles are just as important as your profit,” she said.

Cohen — who still faces a civil suit filed by the Securities and Exchange Commission that could bar him from trading — was dubbed the “Hedge-Fund King” for producing annualized returns of about 25 percent, besting most of his rivals and allowing SAC to command outsized fees from its investors.

While most funds charge investors a 2 percent management fee and 20 percent of their profits, Cohen’s once-sterling reputation allowed him to collect a 3 percent fee and a whopping 50 percent of the profits.

Cohen’s personal wealth is estimated at $9.4 billion, ranking him number 41 among America’s richest people, according to Forbes.

Eight former SAC traders have been busted since the FBI began probing inside trading at hedge funds in 2006, with six of them pleading guilty and two set for trial later this month.

In a statement, SAC Capital said: “We take responsibility for the handful of men who pleaded guilty and whose conduct gave rise to SAC’s liability.”

“The tiny fraction of wrongdoers does not represent the 3,000 honest men and women who have worked at the firm during the past 21 years. SAC has never encouraged, promoted or tolerated insider trading,” the company added.