A Loudoun County, Va., sheriff’s deputy and two Walmart security officers were wounded Saturday when a theft suspect drew a gun and opened fire, the sheriff’s office said.

A second deputy returned fire, wounding the suspect, who was later taken into custody, Sheriff Mike Chapman said. None of the injuries appeared to be life-threatening, officials said.

The gunfire broke out Saturday afternoon at the Dulles Crossing Plaza Walmart in the Sterling area, Chapman said.

The deputies were sent there to take the man into custody after a theft investigation by store security officers.

However, Chapman said, the suspect pulled a gun from his waistband and began shooting. One of the deputies and two store security officers were hit in the legs, Chapman said.

The suspect drove off in a vehicle with keys left inside, said Kraig Troxell, a sheriff’s office spokesman. He said the vehicle crashed on Presgraves Court in the Chantilly area of Fairfax County, and the suspect was later taken into custody. No name or information about any charges were immediately available.

Steve Thompson contributed to this report.