Walgreens has agreed to pay $180,000 to a longtime South San Francisco cashier with diabetes who was fired in 2008 for grabbing and eating a $1.39 bag of chips to fend off an attack of low blood sugar, a federal civil rights agency said Wednesday.

The Equal Employment Opportunity Commission announced the settlement of a discrimination suit it filed on behalf of Josefina Hernandez, 57, who had worked for the nation's largest drugstore chain for almost 18 years. The payments cover lost wages and emotional distress, said EEOC attorney Cindy O'Hara.

The commission said Hernandez, whose diabetic condition was known to Walgreens, had an attack of hypoglycemia while working in September 2008. She started shaking and sweating, and took a bag of chips to stabilize her blood sugar.

Asked later why she had taken the chips without paying, she wrote a note saying, "My sugar low. Not have time." A security officer testified later that he hadn't understood what she meant and didn't ask for an explanation.

Hernandez said she paid for the chips after recovering from the attack. Walgreens denied any connection between her actions and her illness, and fired her for violating a company policy against eating food products before paying for them. O'Hara said Hernandez has been out of work since then.

Walgreens agreed to a settlement after U.S. District Judge William Orrick rejected the company's attempt to dismiss the suit in April, saying Walgreens had not shown any other misconduct by Hernandez, and a jury should decide whether she was fired because of her disability. In addition to the payments, Walgreens agreed to train its staff on accommodating disabled workers, the EEOC said.

Chris Murray, a lawyer for Walgreens, said in a statement that the settlement was "consistent with our past and future commitment as an industry leader for accommodating the special needs of any employee who has an illness or disability."