Saturday afternoon, Kevin Crane, 33, walked into the Paper Source store where his ex-wife, Parisa Saddiqi, worked inside the mall and fatally shot her, authorities said. Crane then shot himself and remains hospitalized.
Back in September 2014, Ventura County sheriff's deputies arrested Crane on suspicion of felony domestic battery after investigators determined that he had struck Saddiqi during a fight, leaving her with minor injuries.
MORE: Details emerge about victim, suspect in Thousand Oaks mall shooting
During the arrest, the deputies seized a .40 caliber handgun that belonged to Crane "for safekeeping," Sgt. Eric Buschow said, a sheriff's office spokesman.
Prosecutors filed a misdemeanor domestic battery charge against Crane and asked a judge to confiscate his gun, which was being held by sheriff's officials. Crane did not object to the petition and a judge formally ordered that the handgun be confiscated in November 2014, authorities said.
In January 2015, the charge was dismissed because Siddiqi stopped cooperating with investigators, the sheriff's department said.
Crane later contacted the California Department of Justice and received a letter saying he was eligible to possess a gun. He later went to the sheriff's office and the confiscated gun was returned to him, officials said.
Crane was legally allowed to purchase a gun - because he wasn't convicted of a crime - but the sheriff's department should not have returned the gun that was confiscated, Buschow said.
At the time, the sheriff's department employees who returned the weapon were "unaware of the court's order to confiscate the firearm at the time it was returned to Crane," the sheriff's department said in a statement.
The sheriff's department said records show the court order had been received by their office about six months after the gun was wrongfully returned.
An investigation is underway to determine how the mistake could have happened.
A GoFundMe account has been set up for Saddiqi's two boys, who are 3 and 4 years old. If you would like to donate to the GoFundMe page, you may do so by going to gofundme.com/dztr4-in-loving-memory-of-our-friend.
The Associated Press contributed to this report.