A sheriff's office mobile command unit is seen in the parking lot outside the entrance to the Costco in Sterling on Wednesday. (Caitlin Gibson/The Washington Post)

A Loudoun County sheriff’s deputy shot and killed a woman who came at him with a knife at a busy Costco in Sterling on Wednesday afternoon, authorities said, causing confused and frightened shoppers and employees to duck behind cash registers and rush out of the store.

Two deputies went to the store to check a report of a disorderly person and used a Taser to try to subdue the woman, Loudoun Sheriff Michael Chapman said. But the woman kept advancing, so one of the deputies fired at her and killed her, the sheriff said. The second deputy was wounded, possibly when a bullet ricocheted and hit his leg. He is expected to recover.

Sheriff’s officials identified the woman as Mhai Scott, 38, who lived near Dulles Town Center and worked for Club Demonstration Services, which provides services to Costco.

Renee Haber, a manager at the store, near the busy intersection of Cascades Parkway and Route 7, said Scott, who was involved in food preparation, became agitated and began to act erratically as her shift was ending. She said Scott, who had been serving pizza, began saying “crazy things” and seemed concerned about the number of servings in a pizza box.

As Scott was moving away from her serving station, Haber said, she grabbed a knife from another station and was making “strange movements.”

“She was frightening her supervisor,” Haber said. Haber said workers called police.

The first deputies arrived at the store just after 3 p.m., Chapman said. When they encountered Scott near the rear of the store, she was armed with a knife and might also have had scissors, he said.

“Preliminary indications are that she came at the deputies with a knife,” Chapman said. Sheriff’s officials said in a prepared statement Wednesday night that Scott ignored orders to drop the weapon.

“It’s a tragic situation,” the sheriff said. “I feel for everybody involved.”

Chapman said that investigators are interviewing witnesses and reviewing surveillance tapes but that he feels “confident in the way our deputies responded.”

Nora LaTeef said she had just sat down to enjoy a berry smoothie at Costco’s food court — after finishing her weekly grocery shopping with her parents — when uniformed sheriff’s deputies burst into the store. The deputies headed toward what appeared to be an employee lounge and then dashed down the aisles, crouching as they moved, LaTeef said.

LaTeef said that she could tell that the deputies “were coming in for action” and that she remarked to her mother that they should probably leave. As her father went to fill up his soda, LaTeef said, five muffled gunshots were heard.

In an instant, she said, employees and customers were screaming: “Get out of the Costco! Get out of Costco!” as they stampeded for the exit.

Peggy Waters of Cascades said she was in line at the big-box store with her 22-year-old son when she saw deputies run in with hands on their holstered guns. The deputies first jiggled a door on what she thought was an office and then headed down a main aisle to the back of the store.

Waters heard what she thought were four shots, she said, and her son heard five. “I had no idea what was going on,” she said.

Some people crouched behind the cash registers, but most ran for the nearby doors, Waters said. “I said, ‘Son, I think we better get out of here,’ ” she said, and they went to the parking lot.

Robert Krause of Ashburn said that he was near the front of the store when he heard “about five” pops but that he didn’t immediately recognize the sounds as gunfire.

“Everyone was running out of the building not knowing what was going on,” Krause said. ”I was a little scared so I got out of there pretty quick.”

Sheriff’s officials said the wounded deputy was being treated for a wound to the leg.

Krause said he saw the injured deputy being carried from the store. ”He looked like he was on his cellphone as he was being carried out, so I hope he’s okay.”

LaTeef said the incident was frightening. “It was really horrible,” she said. “You don’t feel safe, and this is our back yard. Costco is our back yard. You go there all the time.”