A New York City police officer agreed on Monday to serve more than 15 years in prison as part of a plea bargain under which he admitted to stealing guns from his colleagues’ precinct house lockers and selling them.

The officer, Nicholas Mina, 32, was arrested in July along with four other defendants who prosecutors said worked in concert despite their diverse backgrounds. In addition to Mr. Mina, the group included a former dot-com millionaire, a longtime police informer and a 64-year-old woman.

Mr. Mina, whose lawyer said he had stolen the guns to support an addiction to pain medication, is the third of the five to plead guilty to selling guns and to other charges. Ivan Chavez, 25, who had served as a confidential police informer on other illegal gun cases, was sentenced to 20 years in prison. Marcos Echevarria, 22, was sentenced to eight years in prison.