As he approached retirement this year, an F.B.I. agent in New York told a friend in an e-mail that his decades of work in law enforcement were finally about to pay off.

“I’ve made us all stinking rich!!!” the agent wrote, telling the friend to start planning how to spend a $1 million gift that would be arriving soon. “For 30 years I’ve sacrificed to get to this point.”

But his exit strategy, according to federal prosecutors, included his participation in a multimillion-dollar international scheme that involved the lieutenant colonel in charge of the United States Army’s Special Forces operations in Afghanistan and a Boston-based defense contractor.

The prosecutors say that the contractor, Michael Taylor, a former member of an Army Special Forces team, in 2007 won a contract eventually worth $54 million to train Afghan commandos. He did so with secret help from Lt. Col. David Young, who has since retired from the Army but at the time was in charge of Special Forces operations in the country, and then made kickback payments to the colonel, according to court records.