For the second time in five years, prosecutors have prevailed over Sergey Aleynikov, the former Goldman Sachs programmer accused of stealing confidential computer trading code from the bank. The first time it took a federal jury just hours to convict; this time it came after more than a week of deliberation and an accusation of “food poisoning” and avocado tampering in a state court jury room.

A jury on Friday convicted Mr. Aleynikov on one count he faced but acquitted him on another and deadlocked on a third. Mr. Aleynikov, who is unlikely to face much if any prison time, cracked a nervous smile after the decision was announced.

The split verdict — a striking conclusion to a case that divided the legal world, inspired a best-selling book and spotlighted the secret formulas behind high-frequency trading on Wall Street — came after the case nearly ended in what would have been the most bizarre of mistrials.

The possible mistrial stemmed from a dispute between two jurors deciding Mr. Aleynikov’s fate; a female juror accused a male one of “food tampering,” in part because an avocado was missing from her sandwich. The female juror also said she took a blood test to determine whether she had been poisoned, temporarily turning the criminal proceedings into a culinary whodunit.