A New Mexico woman got a nasty surprise right as she headed into the home stretch of the Valles Caldera Marathon on Saturday — an angry black bear.

Karen Williams was on mile 23.5 of the 26.2 mile race when she startled the bear, whose cub ran up a nearby tree, according to authorities.

The bear immediately started attacking Williams, and did not stop until the runner played dead. She shared the details of the attack on Facebook.

"There was some sort of seep or pond or mucky area at the top of that little hill and when I topped it a bear was charging me," she wrote. "I raised my arms and yelled 'NO!' then saw the cub. Then I was on my ass and being raked with claws and bitten. I cried out in pain and Mama bear did not like that so she hit me with a left hook and bit my neck and started to try to shake me. I rolled into a ball and played dead. She went off about 25 - 30 feet and stopped at the base of a tree and huffed at her cub... Mama bear kept glancing my way to make sure that I was still 'dead'. I was at that point afraid I might die. I didn't know what the wound on my neck was like because I did not move for fear she would come wail on me some more."

The bear eventually left, and Williams was airlifted to the University of New Mexico Hospital. She wrote that she has "a fractured right orbit from the mean left hook, missing parts of eyelid and eyebrow, injury to the belly of my left bicep and a lot of punctures and lacerations." Williams' husband Mike Engelhardt reported that she is doing "quite well."

After the attack, the bear was tracked and killed by the New Mexico Department of Game and Fish, as per its policy for wild animals who attack humans. Department Director Alexandra Sandoval said in a statement, “It is regrettable when a wildlife encounter results in human injuries and requires we euthanize the animal."

The bear was part of a study, and was wearing a GPS tracking device confirming her location at the time of the attack. Officers are "confident" that they got the right bear.