The federal government worked to seize guns from thousands of people who should not have been able to purchase firearms because of criminal records, mental health issues or other criteria that typically prohibit them from doing so, according to a report.

The FBI issued more than 4,000 orders last year for agents with the Bureau of Alcohol, Tobacco, Firearms and Explosives to take back guns from owners who failed background checks and should’ve been disqualified from purchasing them, according to USA Today.

Those purchasing a firearm from a federally licensed dealer must undergo a check under the FBI’s National Instant Criminal Background Check System. Under federal law, a firearm sale can proceed if a background check is not completed within 72 hours.

ATF agents are then instructed to seize guns from those who were able to purchase firearms, but the FBI later finds should have been denied.

It is unknown how many of the requests were successfully executed or how many firearms were taken back, according to USA Today.

NICS examiners handled a record 27.5 million background checks last year, and the FBI issued seizure requests for 4,170 gun purchases. In 2015, the FBI issued 2,892 such orders.

The background check system came under scrutiny last month after Devin Patrick Kelley, an Air Force veteran, shot and killed 26 people at a church in Sutherland Springs, Texas.

Kelley was able to purchase two guns despite an earlier conviction for assaulting his then-wife and stepson in 2012. He received a bad conduct discharge from the Air Force after he was court-martialed.

Kelley’s conviction should’ve prevented him from buying the firearms, but Air Force personnel at Holloman Air Force Base in New Mexico failed to report the court-martial to the FBI.

The Air Force opened an investigation into the error. Preliminary findings from the Air Force’s review found “similar reporting lapses occurred at other locations.”