LOS ANGELES — A Los Angeles nun who took a vow of poverty has agreed to plead guilty to federal charges for stealing more than $800,000 to pay for a gambling habit, prosecutors announced Tuesday.

Mary Margaret Kreuper, 79, of Los Angeles was charged Tuesday with one count of wire fraud and one count of money laundering, the U.S. attorney’s office said.

Prosecutors said that in a plea agreement, also filed Tuesday, the now-retired elementary school principal acknowledged that over a decade ending in 2018, she embezzled about $835,000 in donations, tuition and fee money from St. James Catholic School in the LA suburb of Torrance.

Kreuper, who was the school principal for 28 years, “controlled accounts at a credit union, including a savings account for the school and one established to pay the living expenses of the nuns employed by the school,” the U.S. attorney’s office said.

In her plea agreement, Kreuper acknowledged diverting money to pay for personal expenses that included credit card charges and “large gambling expenses incurred at casinos,” the U.S. attorney’s office said.

Kreuper could face up to 40 years in federal prison.

A statement from her attorneys said that Kreuper was “very remorseful for what happened” and had been cooperating with law enforcement and the Catholic Archdiocese of Los Angeles.

Kreuper became a nun at 18, said the statement, reported by KNX-AM radio.

“Unfortunately, later in her life she has been suffering from a mental illness that clouded her judgment and caused her to do something that she otherwise would not have done,” the statement said. “She is very sorry for any harm she has caused.”