CEO Mary Barra's handling of the recall scandal may have helped GM avoid a harsher penalty. Source: General Motors.

General Motors (GM -0.04%) has agreed to pay a $900 million fine to end a criminal investigation into its handling of recalls related to defective ignition switches, according to court papers filed on Thursday.

GM will also admit that it misled the government and the public about the safety of its vehicles. It will also be required to submit to some heavy monitoring and restrictions in order to avoid a full-blown criminal prosecution. If approved by a judge, the agreement will provide for "deferred prosecution." The government won't prosecute GM as long as it cooperates with the monitoring and restriction over the next three years.

It's a long way from a slap on the wrist. But from what is known so far, the settlement is not as harsh as many GM watchers had expected -- and that reflects well on CEO Mary Barra's handling of the crisis.

A smaller fine than Toyota paid, despite over 100 deaths
GM's settlement has to be evaluated against the $1.2 billion that Toyota (TM 1.07%) paid the U.S. government last year to settle criminal charges related to its own recall scandal. Many observers, including your humble Fool, had expected GM to be hit with a much bigger fine.

GM's errors had much bigger consequences than Toyota's. The defective ignition switches that were in many GM vehicles made last decade are blamed for hundreds of accidents. At least 124 deaths are linked to the defect. 

That's much worse than the problems that got Toyota in hot water -- but the difference seems to be the way that GM's current leadership handled the crisis.

GM has admitted that it failed to report the defects to the government as required. It even admitted that it deliberately concealed the defect from the National Highway Traffic Safety Administration and the general public when it decided, in early 2012, to take the matter outside of its normal recall review process.

It's clear that many people at GM made mistakes, and those mistakes probably cost lives. Some of those mistakes may well rise to the level of criminal errors of judgment. But those mistakes -- or criminal acts -- happened before Barra took over as CEO early last year, and she didn't know anything about them until after she became CEO. 

It looks like that was a critical distinction.

Barra's decision to own up to the mess apparently bought some leniency
From all accounts, Barra acted swiftly after learning of the long-hidden concerns about the ignition switches. She made sure that GM promptly owned up to the mistakes and took action. She didn't just order a recall; she ordered employees to find any other potential safety issues in any other past GM products and to recall those vehicles, too.

She dismissed 15 GM executives, appointed a new corporate safety czar with wide powers, and set up a fund to compensate victims of accidents that happened before GM's bankruptcy. Most importantly, she -- from all appearances, at least -- made sure that GM cooperated fully with Federal investigators from the start. 

She stumbled a few times, and she made a few statements that were a little too carefully parsed. But GM under Barra made a very deliberate choice not to fight the Feds, right from the beginning. 

Toyota stonewalled investigators for months before it got to that point. GM's offenses were arguably far worse. But the Department of Justice has long tried to make it clear that cooperation is worthwhile, and apparently Barra's efforts bought some leniency. 

A big hit to GM's bank account, but it could have been worse
Separately, GM also said on Thursday that it has agreed to settle lawsuits related to the ignition-switch debacle. The settlement, part of an ongoing class action case in federal court in Michigan, will cover about 1,380 individual death and personal injury claimants, GM said. 

GM will take a $575 million charge for those settlements. Add in the $900 million payment to the U.S. government (which is reportedly due before the end of next week), and GM's third-quarter earnings will take a big hit.

But it's a smaller hit than it could have been, and it looks like Barra's solid handling of the crisis has helped mitigate the financial damage to GM.