A former Massachusetts police officer pleaded not guilty on Monday to stealing nearly $400,000 from his department's evidence room over the course of 30 years, the state attorney general's office announced.

Kevin Burnham was arraigned in Hampden Superior Court on seven counts of larceny and then released on personal recognizance after agreeing to surrender his passport and alert probation officials if he leaves Massachusetts.

Burnham served as a police office for the Springfield Police Department from 1984 until his retirement in July 2014.

AG Maura Healey says Burnham was the department's narcotics evidence officer, and oversaw the storage and safekeeping of drugs, drug paraphernalia and cash seized in drug cases.

An investigation revealed that Burnham allegedly stole nearly $400,000 in cash from evidence envelopes in more than 170 drug cases from 2009 to his retirement.