Goldman Sachs (GS -0.20%) has agreed with the government of Malaysia to settle a criminal investigation over alleged wrongdoing in that country's high-profile 1MDB scandal. Goldman Sachs will pay a total of $3.9 billion in the settlement.

1MDB stands for 1Malaysia Development Berhad, a strategic development fund owned and operated by the government of the sprawling Asian country. 1MDB made investments into such assets as power plants and casinos but soon veered into more questionable purchases. At one point, it even plowed money into the production of a noted American feature film, Martin Scorsese's The Wolf of Wall Street.

Kuala Lumpur cityscape with skyscrapers and other buildings overlooking landscaped area.

Image source: Getty Images.

However, the fund incurred massive debt because its financial assets were allegedly embezzled; the country's prime minister at the time, Najib Razak, and associates stand accused of benefiting from this activity.

In 2012, Goldman Sachs raised $6.5 billion for 1MDB through bond issues for which it reaped fees of $593 million. Malaysian prosecutors allege that the bank lied to, and omitted crucial information from, investors in these bonds. They filed criminal fraud charges against three Goldman Sachs subsidiaries and 17 executives involved in the bond issues, with the aim of recovering $7.5 billion; those charges are to be dropped.

"We are pleased to have reached an agreement in principle with the Government of Malaysia to resolve outstanding charges and claims against Goldman Sachs," the company said in a statement.

The settlement does not entirely get Goldman Sachs out of the woods with the 1MDB scandal. The U.S. Department of Justice is conducting its own investigation of the company over its conduct in the affair.

Investors traded the bank's shares down on Friday; they fell by nearly 0.8%, broadly matching the declines of the major equity indexes.