DALLAS - A missing gun that was loaned to Texas Democratic nominee for governor Lupe Valdez has been found. It was apparently in the Dallas County Sheriff’s Office’s property room the whole time.

DCSO loaned the 9mm Beretta to Valdez in 2011 after her own service weapon malfunctioned. She was sheriff for the department for 13 years before stepping down in December to challenge Republican Gov. Greg Abbott.

Abbott criticized her on Twitter after hearing reports about the missing gun.

“Lupe Valdez wants to run the state of Texas but can’t even keep track of her gun? Texans deserve better,” he wrote.

On Tuesday, DCSO spokesman Raul Reyna said the gun was located as the department was investigating whether it had been misplaced, lost or stolen.

"So the weapon was turned in, but it was never recorded on the computer and in our inventory,” said Interim Sheriff Marion Brown. “And so that's why we went back and put hands on every weapon we had so that we could find out if indeed we had custody of the weapon. And we did."

DCSO apologized for “any distress and hardship that was created as a result of the department’s mistake.” The department also plans to review the oversight and make changes so that it can’t happen again.

Campaigning on Tuesday in Abilene, Valdez did not respond on camera to the gun’s discovery and Sheriff Brown’s apology. Her campaign released a statement saying “This incident further illustrates the importance of gun owner accountability and firearms safety… Throughout my law enforcement and military career, I have always followed protocol when returning issued property."

Valdez is a heavy underdog in Texas, which hasn't elected a Democrat governor in 28 years. She won the nomination in a May primary runoff and if elected would be Texas' first Hispanic and openly gay governor.

Valdez has accused Abbott of insufficiently addressing gun safety in the wake of a gunman killing 10 people at a high school near Houston in May. The governor responded to the shooting with a 43-page plan that included improving gun storage safety laws.

In June, Valdez wrote in an editorial in the Houston Chronicle that parents should be held accountable if "reckless storage of weapons" allows children to gain access to a firearm.