NEW YORK — A Lehman Brothers whistleblower warned his bosses that accounting tricks the bank used before its collapse may have been illegal, his lawyer said Friday.

Matthew Lee, a former Lehman senior vice president, was fired days after questioning the gimmicks in a letter to his superiors, attorney Erwin Shustak said. Shustak gave a copy of the letter to The Associated Press.

Lehman Brothers Holdings Inc. imploded in September 2008, becoming the biggest corporate bankruptcy in U.S. history. The collapse sent financial markets across the globe into a free-fall and prompted a massive bailout of the U.S. banking system.

An examiner appointed by the bankruptcy court said in a report last week that Lehman hid its debt and perilous financial condition by using an accounting gimmick called Repo 105. The report revealed Lee’s warnings to the bank, though his letter makes public the first internal assessment of the legality of Lehman’s bookkeeping.

In a letter dated May 18, 2008, Lee wrote that he discovered that the bank had been underreporting its debt by about $5 billion at the end of each month.

Lee, 56, wrote that he felt compelled to report the “discrepancies” under the firm’s code of ethics, saying he believed they “possibly constitute unethical or unlawful conduct.”

Days after sending the letter, the firm told Lee he was being terminated as part of a general layoff, Shustak said.

Lee later reached a severance agreement with Lehman. However, he stopped receiving payments after the firm’s collapse, Shustak said. He has filed a claim with the bankruptcy court to recover the unpaid amount.

Senate Banking Committee Chairman Christopher Dodd, D-Conn., on Friday called for Attorney General Eric Holder to investigate the circumstances that led to Lehman’s collapse. A Justice Department spokeswoman said the department would review the request.