He was, he told Goldman, joining a new trading company, which various news reports said was in Chicago. He said he would earn triple the $400,000 salary he commanded at Goldman.

But, just before he left, according to the complaint, Mr. Aleynikov used his desktop computer at Goldman’s New York offices to upload a stream of code to a Web site hosted by a server based in Germany.

Later, he downloaded the files again to his home computer, his laptop computer and to a memory device.

He was caught when the bank noticed the surge of data leaving its servers  and despite his prowess as a highly paid programmer, his activities were recorded even though he tried to erase his programming commands because Goldman kept back-up records.

When confronted by federal investigators at the airport in Newark, Mr. Aleynikov, a naturalized American citizen who immigrated from Russia and now lives in New Jersey, insisted that he had intended to collect “open source” files on which he had worked and only later realized he had copied more files than he had intended.

On Monday, Goldman Sachs refused to comment publicly on the attempted theft. A person familiar with the bank said it had since “secured its systems.” This person, who asked not to be identified, given the confidential nature of the programs, insisted that the theft had had no effect on Goldman Sachs’s business or on that of its clients.

However, at a court appearance in Manhattan on July 4, Joseph Facciponti, the assistant United States attorney, told a federal judge that Mr. Aleynikov’s supposed theft posed a risk to United States financial markets and that other people may have had access to it, according to Bloomberg.