A longtime bomb expert for the Federal Bureau of Investigation has agreed to plead guilty to disclosing closely guarded details of a 2012 terror investigation to the Associated Press.

Authorities said Monday that Donald Sachtleben, who retired from the FBI in 2008 but continued to work for the agency as a consultant, gained knowledge of a failed 2012 "underwear bomb" plot by al Qaeda.

Mr....