A woman who brought a gun to a Portland elementary school where it accidentally went off in a crowded cafeteria pleaded guilty Tuesday to charges of reckless endangerment.

Antoinette Riley, 28, was sentenced to three years of probation by Multnomah County Circuit Judge Nan Waller.

The judge also barred Riley from going on any Portland Public Schools property or possessing any guns. Riley must complete 80 hours of community service.

On Oct. 4, Riley went to pick up her children from an after-school program at Jason Lee Elementary in Northeast Portland. She was in the cafeteria with about 50 other people, including children, when the gun went off. She had been carrying it in in a backpack.

The bullet struck Riiley in the buttocks and damaged a table where she and her children were sitting.

Immediately after the gunfire, Riley fled the school, but an after-school program supervisor identified her to police as the source of the gunfire, according to a probable cause affidavit.

Riley and her children were gone by the time officers arrived at the school, but she was later arrested in the area. According to the affidavit, a detective found an apparent bullet hole in the backpack Riley had, but it's not clear where on the bag.

She initially denied responsibility, telling KPTV that she never had a gun, was sitting at a table in the cafeteria with her son, reached for her phone next to her bag and then was struck from an unknown direction.

In court, Riley admitted to bringing the gun to the school and apologized to the court.

Antoinette Riley, 28, was sentenced to 3 years probation for bringing a gun to a Portland elementary school in October where it accidentally went off. Courtesy/Multnomah County Sheriff

Her defense attorney indicated she had the gun in her bag out of fear of an ex-boyfriend. The weapon was never recovered and Riley said in court that she had thrown it into a sewer.

Riley initially was charged with possession of a gun in a public building, unlawful possession of a gun and possession of a loaded gun in public, but Waller accepted her plea to the reduced charges, noting Riley had no criminal record.

“Thank goodness no child, no faculty, no other parent were hurt that day,” Waller said before she handed down the sentence. “This incident could have had an unbelievably devastating impact.”

Aimee Green of The Oregonian/OregonLive contributed to this report.

-- Kale Williams

kwilliams@oregonian.com

503-294-4048

@sfkale

Visit subscription.oregonlive.com/newsletters to get Oregonian/OregonLive journalism delivered to your email inbox.