BOSTON — A Boston police detective is pleading guilty to lying to federal officials so he could fly armed on personal trips and allow a friend to avoid going through airport security.

The U.S. attorney’s office in Boston on Friday said Sgt. Detective Bruce Smith has agreed to resign from the police force and pay a $7,500 fine. Smith also faces up to a year of probation under the terms of a plea deal.

The 53-year-old Randolph resident was charged in June with making false statements to Transportation Security Administration officials that he was on official police business and was authorized to carry his firearm. Prosecutors allege he flew armed on about 28 trips from Logan International Airport in Boston.

Police have declined to comment. Smith’s attorney hasn’t responded to a request for comment.