DETROIT — The criminal case against Volkswagen for its decade-long scheme to cheat on diesel emissions tests ended Friday with a scolding, an apology and $4.3 billion in penalties.

The sentence, affirmed at a court hearing, had been recommended by federal prosecutors in January as part of a deal in which the German automaker agreed to plead guilty to three felony charges for illegally importing nearly 600,000 vehicles equipped with devices to circumvent emissions standards.

The conclusion of the criminal case, 19 months after the vast cheating operation was first revealed, was a milestone in Volkswagen’s recovery from a scandal that badly damaged its reputation and sales. This week it delivered an encouraging quarterly report, and the company has even been given permission to sell — with modifications — the diesel cars at the center of the case.

But the hearing in Federal District Court in Michigan was a reminder of the cloud under which Volkswagen remained.