Former San Diego Mayor Maureen O'Connor has admitted to taking $2.1 million from her late husband's foundation during a decade-long gambling binge that she attributed to depression and the effects of a brain tumor.

She was estimated to have won and lost more than $1 billion through gambling.

O'Connor, 66, pleaded not guilty in federal court to one count of money laundering as part of an agreement with the U.S. Justice Department. The agreement will defer prosecution for two years, giving O'Connor a chance to pay back the money and get treatment for her gambling addiction.

In a news conference, O'Connor acknowledged that she took the money, but she said she "always intended to pay it back."

O'Connor's attorney, Eugene Iredale, said that in 2011 the former mayor was diagnosed with a tumor, which affected the portion of her brain "that controls logic and reasoning and, most important, judgment."

O'Connor has since had the tumor removed.

"There are two Maureens -- Maureen No. 1 and Maureen No. 2," said O'Connor during the news conference. "Maureen No. 2 is the Maureen who did not know she had a tumor growing in her brain."

The U.S. attorney's office cited O'Connor's medical condition as one reason for the deferred prosecution agreement.

"Maureen O'Connor was a selfless public official who contributed much to the well-being of San Diego," said U.S. Attorney Laura Duffy. "However, no figure, regardless of how much good they've done or how much they've given to charity, can escape criminal liability with impunity."

Dr. Joshua Bederson, the head and chairman of the neurosurgery department Mt. Sinai in New York, said O'Connor's claim of her gambling addiction being a symptom of her brain tumor is uncommon but
possible.

"Since we know there are brain areas that are responsible [for the assessment of risk and reward], it is conceivable that some sort of disturbance caused by a brain tumor could influence those functions, as well," said Bederson, who has not worked with O'Connor.

Patients with brain tumors that affect their risk and reward assessment can have other symptoms as well, Bederson said, including memory loss, lack of inhibition and difficulty concentrating.

The former mayor, who served from 1986 to 1992 as San Diego's first female mayor, said she started to gamble after the death of two siblings and her husband, Jack in the Box founder Robert Peterson.

In court filings, Iredale called it "grief gambling." Iredale said O'Connor started gambling in 2001, spending hours playing video poker in various casinos in San Diego, Las Vegas and Atlantic City, N.J.

"She played video poker on machines that were programmed to pay out 80 percent of the money that was put in, so that the more you play the more you lose," Iredale told reporters.

Dr. Howard Shaffer, an associate professor of psychology at Harvard Medical School, said many with gambling addictions suffer from previous psychological conditions such as depression. Shaffer added that the act of gambling can provide a reprieve or a way to cope with other psychological conditions.

"From my patient experience, they certainly report that gambling provides an escape," said Shaffer. "Anyone who has ever suffered knows when you're in pain ... a respite is very attractive."

Shaffer added that many gambling addicts don't realize how damaging their addictions can be.

"They really don't see it as a problem, they just think they've exercised bad judgment," said Shaffer. "They don't see how insidiously it's invaded their life."

O'Connor's annual gambling winnings peaked at $200 million, according to Phillip Halpern, an assistant U.S. attorney. But when O'Connor began to lose, she liquidated her savings, borrowed money from friends and sold real estate, according to prosecutors.

In 2010, she sold her La Jolla, Calif., home, which is down the street from Mitt Romney's, for a reported $2.5 million.

While O'Connor once had a fortune estimated at between $40 million and $50 million, which she inherited from her late husband, she now is nearly broke and living with her sister.

In 2009-2010, O'Connor was estimated to have won more than $1 billion, according to casino documents filed with the Internal Revenue Service. But Iredale said her net losses topped $13 million.

O'Connor, who walked into the courthouse with a cane, did not take questions but apologized for her actions.

"I think most of you that know me here would know that I never meant to hurt the city that I loved," O'Connor said.