A former FBI special agent has been accused of conspiring to sell confidential bureau documents to a Bangladeshi man who was seeking to harm the reputation of a political rival in his native country, the authorities said on Friday.

Robert Lustyik was with the FBI in late 2011 when he began plotting with a childhood friend, Johannes Thaler, according to a criminal complaint unsealed on Friday in U.S. District Court in White Plains, N.Y.

“I will work my magic .... We r sooooooo close,” Lustyik wrote in an exchange of text messages with Thaler, the complaint said.

“I know,” Thaler replied. “It’s all right here in front of us. Pretty soon we’ll be having lunch in our oceanfront restaurant.”

The Bangladeshi who had sought the materials, Rizve Ahmed, paid $1,000 to Lustyik and Thaler for two documents concerning his political rival, the complaint said. One was a suspicious activity report and the other a memo about the man that mentioned $300 million, the complaint said without elaboration. The men planned to seek tens of thousands of dollars in additional bribes for other confidential information, the complaint said.

The complaint did not identify the rival, whom the office of Preet Bharara, the U.S. attorney for the Southern District of New York, described as “a prominent citizen of Bangladesh who was affiliated with an opposing political party” of Mr. Ahmed’s.

Mr. Bharara called Lustyik’s actions “particularly egregious” given that he was an agent who was “willing to compromise the operations” of the FBI.

Lustyik’s lawyer, Raymond Mansolillo, said: “We’re going to fight the allegations. They’re basically snippets of text messages and emails that the government has taken out of context and misconstrued as illegal, which we strongly refute.”

Lustyik is in his early 50s; he worked in counterintelligence, the complaint said. He retired in September after more than two decades with the bureau, an official said. Thaler and Ahmed were also charged.

Lustyik had already been indicted in Salt Lake City on federal charges related to what the government has called a scheme to use his official position to derail an investigation of a business partner. He has pleaded not guilty and has been detained there without bond. In the New York case, when Mr. Ahmed indicated that he and his associates might turn to another source for information, apparently an FBI agent who had retired, Lustyik responded angrily, telling Thaler in one message that they had to “squeeze” Ahmed, the complaint said. — New York Times News Service