James Slatic has turned a leaf.

San Diego District Attorney Summer Stephan agreed on Friday to return to the medical marijuana pioneer and his business, Med-West Distribution, $289,979 — plus $5,484 in interest — that authorities confiscated in a January 2016 raid on his Kearny Mesa facility. So ends a nearly two-year case with sudden and suspenseful turns.

Friday was, in fact, the second time that prosecutors have returned money to Slatic. The first came in May, when a judge ordered the release of more than $100,000 worth of family funds.

At the time, he hadn’t been charged with a crime.

But two weeks later, then-District Attorney Bonnie Dumanis alleged that Slatic and his business partners had sought to illegally manufacture and sell hash oil across the country. He faced 15 felony charges, and it wasn’t until last month that a plea deal was reached in which Slatic instead pleaded guilty to two misdemeanors.

He got a fine and one-year probation.

The additional money that is now being returned to Slatic comes from a civil asset forfeiture settlement that was agreed to Friday, according to a statement released by Stephan. Slatic, in the process, agreed to forfeit $35,000 of the total amount seized. Stephan said $3,500 of that amount will be donated to the Community Alliances for Drug Free Youth, a nonprofit that provides adult and family prevention and treatment services.

Slatic’s case attracted national attention and alarmed many in the legal community after the DA’s office alleged that Slatic’s attorney, Jessica McElfresh, was involved in the scheme and sought to make public communications from clients that would ordinarily be protected by attorney-client privilege. Prosecutors accused her of helping to hide evidence of the hash oil from city inspectors during an April 2015 inspection of Slatic’s facility.

In September, a Slate article contended “The San Diego DA’s office, once under the famously anti-pot leadership of Bonnie Dumanis and now under her anointed successor, Summer Stephan, has taken the narrowest possible construction of marijuana laws and seems poised to challenge the will of the people who overwhelmingly voted in favor of legal marijuana.”

But Stephan’s willingness to cut a deal in which Slatic pleaded only to two misdemeanors, and her move to return the lion’s share of the money seized from Slatic, appears to mark a sharp departure from Dumanis’ approach.

There was no word in Friday’s statement on the pending case against McElfresh.

In a July episode of Voice of San Diego’s “I Made it in San Diego” podcast, Slatic talked about the dramatic ups and downs he’s experienced while building his many businesses.