U.S. Customs and Border Protection spent more than $5 million on polygraph exams for job applicants who admitted to previous illegal activity, which should automatically disqualify people from being hired, according to a Department of Homeland Security Office of Inspector General report released Friday.

CBP data showed that around 2,300 applicants made disqualifying admissions about illegal drug use, drug smuggling, human trafficking, and having relationships with people involved in those crimes. However, all of those candidates were given polygraphs.

At $2,200 per test, the cost quickly crossed into the millions of dollars.

"CBP further failed to consistently use its on-call adjudication process, which gives the examiners an official method to confirm right away that an applicant's pretest admissions are in fact unsuitable and a basis for ending the exam," the report stated.

The inspector general reported CBP has begun to immediately contact adjudicators when an applicant makes a confession. The third party will then decide if the applicant should be disqualified and the application process suspended before a polygraph is scheduled.

CBP is also implementing a pilot program for a new format to polygraphs, a move the inspector general said will serve the agency well in light of its plans to hire thousands more employees over the next few years.

"Given its plans to hire 5,000 additional Border Patrol Agents, it is important that CBP focus its resources on the most qualified and suitable applicants," Inspector General John Roth said in a statement. "We are pleased that CBP has adopted one of our recommended changes to increase efficiency in its polygraph process."